Re: Column name 'user' not allowed?

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Thomas Mueller <news-exp-dec04(at)tmueller(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Column name 'user' not allowed?
Date: 2004-07-07 21:19:37
Message-ID: 20040707141356.E61326@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> Hi,
>
> I tried to install phpopenchat but I can't create this table:
>
> poc=> CREATE TABLE poc_user_account (
> poc(> USER varchar(255) NOT NULL,
> poc(> PASSWORD varchar(255),
> poc(> CONFIRM_CODE char(32),
> poc(> DISABLED int NOT NULL DEFAULT '0',
> poc(> KICKED int NOT NULL DEFAULT '0',
> poc(> PASSWORD_NEW varchar(255),
> poc(> PRIMARY KEY (USER)
> poc(> );
> ERROR: syntax error at or near "USER" at character 35
>
> After searching a while what's wrong I renamed column USER to USER2 and
> now I can create the table! I don't see a reason why column name USER
> isn't allowed?!

USER is a reserved word in SQL (at least in 92, and I think they only
added to the list in later versions) which technically makes it
unavailable as a non-quoted identifier. If you were careful about
quoting, you could use "USER" (note the double quotes) for creating it and
all references to it.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2004-07-07 21:22:34 Re: Column name 'user' not allowed?
Previous Message Bill Moran 2004-07-07 21:17:08 Re: Column name 'user' not allowed?