Re: Is level a reserved keyword? - Mailing list pgsql-general

From Tom Lane
Subject Re: Is level a reserved keyword?
Date
Msg-id 29176.963165090@sss.pgh.pa.us
Whole thread Raw
In response to Is level a reserved keyword?  ("Morten W. Petersen" <morten@src.no>)
List pgsql-general
"Morten W. Petersen" <morten@src.no> writes:
> We've been running a customer telephone service, and we've been storing
> the customers subscription as levels; ie, we have a table, named customer
> with the column "level". INSERT and SELECT have worked on this table, just
> as they should; but now, after moving between two databases of the same
> version, both the psql client, and the pg python adapter complains near
> the word "level". Any ideas? Seems like a bug?

LEVEL is a keyword, but it should not be a reserved word, and it's not
in 7.0:

regression=# create table f1 (level int);
CREATE

I believe 6.5 was missing a whole bunch of entries from the parser's
list of keywords-that-can-also-be-column-names, so it doesn't surprise
me that you see this problem in 6.5.

You could update to 7.0 (recommended solution ;-)), or put double
quotes around "level" in all your queries, or rename the column,
or modify src/backend/parser/gram.y to add a production for LEVEL
to the ColId list.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is level a reserved keyword?
Next
From: Louis Bertrand
Date:
Subject: PostgreSQL vs. MySQL