Search Postgresql Archives

Re: syntax error foreign key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthew Terenzio <matt@xxxxxxxxxxxxx> writes:

> On Aug 16, 2005, at 9:37 PM, Matthew Terenzio wrote:
>
>> db=# ALTER TABLE ONLY table ADD CONSTRAINT "$1" FOREIGN KEY (user)
>> REFERENCES users(user_id);
>> ERROR:  syntax error at or near "user" at character 56
>>
>> I'm either blind or something besides syntax can cause this error. no?
>>
>>
>
> changed the field name to userid and it;s fine. Can't user the word
> user for field that references?

USER is an SQL keyword; you have to put it in double quotes to use it
as an identifier.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux