Re: syntax error foreign key - Mailing list pgsql-general

From Michael Fuhr
Subject Re: syntax error foreign key
Date
Msg-id 20050817023115.GA13913@winnie.fuhr.org
Whole thread Raw
In response to Re: syntax error foreign key  (Matthew Terenzio <matt@jobsforge.com>)
List pgsql-general
On Tue, Aug 16, 2005 at 10:09:14PM -0400, 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?

See "Identifiers and Key Words" in the "SQL Syntax" chapter of the
documentation, in particular the part that talks about quoted
identifiers.  Here's a link for the latest version:

http://www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS

--
Michael Fuhr

pgsql-general by date:

Previous
From: Matthew Terenzio
Date:
Subject: Re: syntax error foreign key
Next
From: Douglas McNaught
Date:
Subject: Re: syntax error foreign key