mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
SQL error with table named 'user' #6412
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 @ashot5706 on GitHub (Feb 24, 2020).
Bug Report
SQLSTATE[42703]: Undefined column: 7 ERROR: column t0.id does not exist
I have table named user, and I getting errors when trying to get something from this table, I looked SQL, and when I'm adding table name in quotes it works, so problem is that in SQL generated by doctrine table name is not in quotes, so this throws error
this is screenshots from VStudio SQL editor


@beberlei commented on GitHub (Feb 25, 2020):
You need to escape the columns like this with the tick symbol ` (I assume you are using the ORM since you opened your issue here):
Doctrine converts that into quoted columns using the underlying databases identifier quoting syntax.
The other alternative is to use a naming strategy and automatically quote every identifer.