Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc> writes:
> On 08/14/2010 02:14 AM, Samuel Marinov wrote:
>> ERROR: syntax error at or near "user"
>> LINE 1: create table ftp (user varchar, password varchar);
> not sure why you consider this a bug - but "user" is a reserved word in
> PostgreSQL and the SQL-Standard (see
> http://www.postgresql.org/docs/9.0/static/sql-keywords-appendix.html) so
> you would have to quote the keyword like:
> create table ftp ("user" varchar, password varchar);
> in your code - but I would advise against using reserved words at all
> because you will end up having to quote them all over the place in each
> and every query.
Yeah. The reason it's reserved is that per spec, USER is equivalent to
CURRENT_USER, ie it's a built-in function that returns the current login
name. So anytime you forgot and wrote
select user from ...
select "user" from ...
it would still work and you'd get mysteriously wrong output. You
don't want to go there.
regards, tom lane
In response to
pgsql-bugs by date
|Next:||From: Tom Lane||Date: 2010-08-14 13:30:49|
|Subject: Re: BUG #5608: array_agg() consumes too much memory |
|Previous:||From: Stefan Kaltenbrunner||Date: 2010-08-14 08:19:01|
|Subject: Re: BUG #5620: PostgreSQL won't accept the word "user" as
a valid column name|