The following bug has been logged online: Bug reference: 5258 Logged by: Ben Woosley Email address: ben.woos...@gmail.com PostgreSQL version: 8.4.2 Operating system: Mac OS 10.6 Description: Unique and foreign key constraints fail on columns with reserved names, but not check constraints Details:
Check constraints successfully accept columns named with reserved words when they are qualified by table using the . syntax, e.g. "check (mod(table.as, 2) = 0)" However, unique and foreign key constraints added using the "alter table add constraint" syntax fail on the column name. At this point the statement has enough information (the host table name) to properly identify the column despite the unorthodox name. Alternatively, you could allow the . syntax qualification inside the argument to the constraint. Now, you may say that this is a reserved word and should never be used, but coming from the Ruby world, where reserved words are only reserved when they're truly ambiguous, I very much appreciate the freedom of using these names when it's unambiguous. This particularly so given that keywords are often chosen for their terseness and overlap with the most appropriate column name. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs