mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1360: Reserved words escaping fails when using multiple reserved words #1705
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 (Sep 3, 2011).
Originally assigned to: @guilhermeblanco on GitHub.
Jira issue originally created by user elnur:
Everything works fine when I use the
@Tableannotation like this:@Table(name="user"). But when theusertable is in theuserschema and I try to use the annotion in this way:@Table(name="user.user")— everything falls apart.A quick look into the code showed that it checks if the table name starts with
, and if it does, it sets thequotedparameter totrueand removes thecharacters on the both sides. So, if I quote the both words like@Table(name="user.user"), the table name becomes"user.user"and it, of course, fails. If I quote it just like@Table(name="user.user"), the table name becomes"user.user", which fails too.If Doctrine allows to escape the reserved words, it should take into account this kind of usage as well.
@doctrinebot commented on GitHub (Sep 5, 2011):
Comment created by @guilhermeblanco:
By now, it's currently impossible to do cross database joins in an easy way.
We have planned it through the schema support in @Table.
I'll be working on this support for 2.2, but until there, my only recommendation is to not use a keyword as a table name.
Cheers,
@doctrinebot commented on GitHub (Sep 5, 2011):
Comment created by elnur:
It's not cross database; it's just
schema.tablein PostgreSQL. It works when not using reserved words, but fails with them.@doctrinebot commented on GitHub (Oct 28, 2011):
Comment created by @beberlei:
How much of this ticket does your commit from some weeks ago cover guilherme?
@doctrinebot commented on GitHub (Nov 16, 2011):
Comment created by @beberlei:
Fixed for 2.2
@doctrinebot commented on GitHub (Dec 21, 2011):
Comment created by elnur:
It still doesn't work. Tried on
master.@doctrinebot commented on GitHub (Dec 21, 2011):
Comment created by @beberlei:
what kind of error do you get?
@doctrinebot commented on GitHub (Dec 28, 2011):
Comment created by @beberlei:
could reproduce the problem with table names and sequence names.
@doctrinebot commented on GitHub (Dec 28, 2011):
Comment created by @beberlei:
Fixed.
@doctrinebot commented on GitHub (Dec 29, 2011):
Comment created by elnur:
I've just got fresh clones of
doctrine-doctrine2,doctrine-dbalanddoctrine-common— all on theirmasterbranches.My entity has this annotation:
I'm getting the following exception:
So, it's translating
user.userto"user.user", while it should be"user"."user".@doctrinebot commented on GitHub (Dec 29, 2011):
Comment created by elnur:
What changed is that earlier
user.userwas translated to"user.user", while now it's translated to"user.user", but should be to"user"."user".I saw the commit related to this ticket (
959a68694e) and I want to note that I'm getting this error not when creating a table, but when querying it. I don't use Doctrine for creating tables anyway — I do it via plain SQL.@doctrinebot commented on GitHub (Dec 31, 2011):
Comment created by @beberlei:
I keep trying until i fixed this, now with a commit into DBAL:
4cb8a99b65Will be included in Beta 2
@doctrinebot commented on GitHub (Dec 31, 2011):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 31, 2011):
Comment created by elnur:
Now
user.user,user.useranduser.userget escaped properly, ending up as"user"."user". Interestingly enough, even only the beginning tick like inuser.userends up as"user"."user"`.user.user, though, results inuser.user— that is, nothing gets escaped. I don't think this is a big deal, because if I can escape both schema and table name parts, then I won't run into problems. I'm pointing this out in case it was intended to affect the escaping too.Good job, thanks.