Обсуждение: Reserved words and workarounds...

Поиск
Список
Период
Сортировка

Reserved words and workarounds...

От
Matt Clark
Дата:
I am attempting to convert an existing DB and client code from DB2 and/or Oracle
to run using PostgreSQL.

One major problem is that there appear to be a number of words that cannot be
used as column names.

Specifically, the DB creation SQL includes the following:

create table table1 (init-id integer, offset integer);


which barfs at the column-name "offset".  Likewise, any SQL which attempt to
insert a value into "offset" causes a problem.....

Changing the source code of the client program, which generates the SQL, is not
an option.  Is there a fix or kludge which will allow Postgres to get by this
problem?

What other words are restricted from being used as column names?

Thanks,

Matt





Re: Reserved words and workarounds...

От
Tom Lane
Дата:
Matt Clark <mclark@rushe.aero.org> writes:
> Changing the source code of the client program, which generates the
> SQL, is not an option.

I'm afraid you're SOL then :-(

> What other words are restricted from being used as column names?

See
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/sql-keywords-appendix.html
for a pretty complete rundown.  Note that LIMIT is considered a reserved
word per SQL99 (though not per SQL92) ... so you will not get a whole
lot of sympathy for any request to make it unreserved.  We already do
our best not to reserve more keywords than we have to.

            regards, tom lane