mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3148: ResultSetMappingBuilder::generateSelectClause ignores quoted column names #3904
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jun 2, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user c.ruhstaller:
If an entity has a quoted column (Magic Words etc.) and you want to use "generateSelectClause" for the specific entity it won't return the quoted name, just the plain name. If the name is a SQL Magic Word the corresponding SQL will fail.
Exp.: "profile.real" (wrong) instead of "profile.
real".File: Doctrine/ORM/Query/ResultSetMappingBuilder.php
Function: generateSelectClause
Line 445:
$sql .= " AS " . $columnName;
Example Entity:
...
class Profile
{
/****
* @ORM\Column(name="
real", type="boolean")*/
protected $real=false;
}
@yurtesen commented on GitHub (Dec 5, 2017):
I have a similar problem with generateSelectClause() also. I am using
creof/doctrine2-spatialand it uses ST_AsEWKT() function when fetching spatial data columns. However when I use generateSelectClause() it simply passes column name and this causes problems.@Ocramius commented on GitHub (Dec 5, 2017):
Requires a test case to be reproduced
@yurtesen commented on GitHub (Dec 5, 2017):
@Ocramius unfortunately I am not familiar enough with doctrine to create a minimal test and I dont have time right now. However I found that there is a test which uses a custom type . Perhaps if one makes a table which uses this type, and then try to call generateSelectClause() then one can see that it does not wrap the column with UPPER() function. I may come back to this later, but right now I have more pressing problems. Because I can work around this problem by not using the feature.
@Ocramius commented on GitHub (Dec 5, 2017):
@yurtesen see
f13f7ebe54/tests/Doctrine/Tests/ORM/Functional/Ticketfor examples@smarcet commented on GitHub (Mar 3, 2021):
any news on this one ? basically method generateSelectClause ignores quoting metadata set on column at class mapping so its leads to invalid SQL if the column has a reserved word as name
@smarcet commented on GitHub (Mar 3, 2021):
created pull request https://github.com/doctrine/orm/pull/8522
@alex-dev commented on GitHub (Aug 10, 2023):
Still an active bug.
@alex-dev commented on GitHub (Aug 10, 2023):