Re: [BUGS] BUG #5258: Unique and foreign key constraints fail on columns with reserved names, but not check constraints

2010-01-04 Thread Peter Eisentraut
On mån, 2010-01-04 at 03:48 +, Ben Woosley wrote: 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

Re: [BUGS] BUG #5258: Unique and foreign key constraints fail on columns with reserved names, but not check constraints

2010-01-04 Thread Robert Haas
On Sun, Jan 3, 2010 at 10:48 PM, Ben Woosley ben.woos...@gmail.com wrote: 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

Re: [BUGS] BUG #5258: Unique and foreign key constraints fail on columns with reserved names, but not check constraints

2010-01-04 Thread Ben Woosley
These work: alter table books add constraint books_from_within check (books.from = 5 and books.from11); alter table books add constraint books_as_whitelist check (books.as in ('whitelisted1','whitelisted2','whitelisted3')); These don't: alter table books add constraint books_from_reference

Re: [BUGS] BUG #5258: Unique and foreign key constraints fail on columns with reserved names, but not check constraints

2010-01-04 Thread Tom Lane
Ben Woosley ben.woos...@gmail.com writes: These work: alter table books add constraint books_from_within check (books.from = 5 and books.from11); alter table books add constraint books_as_whitelist check (books.as in ('whitelisted1','whitelisted2','whitelisted3')); These don't: alter

Re: [BUGS] BUG #5258: Unique and foreign key constraints fail on columns with reserved names, but not check constraints

2010-01-04 Thread Ben Woosley
Thanks Tom, I hadn't tried double-quoting, which worked fine. I'm only so well acquainted with SQL and had only tried single quotes and backticks. So, there is a way, and I'm satisfied with it. Bug retracted - thanks! -Ben On Mon, Jan 4, 2010 at 1:30 PM, Tom Lane t...@sss.pgh.pa.us wrote:

[BUGS] BUG #5258: Unique and foreign key constraints fail on columns with reserved names, but not check constraints

2010-01-03 Thread Ben Woosley
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