Обсуждение: Is "isolation" a restricted word?

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

Is "isolation" a restricted word?

От
"G. Anthony Reina"
Дата:
I am trying to make a table with a class called "isolation". For some
reason, I am getting a parser error:

=> create table cell ( isolation text );
ERROR:  parser: parse error at or near "isolation"

If I just take off the "n", I get:

=> create table cell ( isolatio text );
CREATE

This table had no problems previously; has the word isolation been used
somewhere else as a SQL word? I can't think of why else I am having
problems with the table (the syntax appears to be correct).

Thanks.
-Tony



Re: [HACKERS] Is "isolation" a restricted word?

От
"Ross J. Reedstrom"
Дата:
On Mon, Sep 13, 1999 at 02:36:48PM -0700, G. Anthony Reina wrote:
> I am trying to make a table with a class called "isolation". For some
> reason, I am getting a parser error:
> 
> => create table cell ( isolation text );
> ERROR:  parser: parse error at or near "isolation"
> 
> If I just take off the "n", I get:
> 
> => create table cell ( isolatio text );
> CREATE
> 
> This table had no problems previously; has the word isolation been used
> somewhere else as a SQL word? I can't think of why else I am having
> problems with the table (the syntax appears to be correct).

Yup - here it is in pgsql/src/backend/parser/keywords.c:

...       {"is", IS},       {"isnull", ISNULL},       {"isolation", ISOLATION},       {"join", JOIN},       {"key",
KEY},      {"lancompiler", LANCOMPILER},
 
...

This table should in fact be the definitive guide, since it's the array
that the parser uses ;-)

And it's mentioned in the HISTORY file as part of the MVCC
changes. They're a couple of these 'gotcha' words that are part of
the SQL standard, but hadn't yet been implemented before 6.5 that have
triped up people.

If you have to keep the table name, quote it:

create table cell ( "isolation" text );

But then you'll always have to quote it. I'm stuck with a bunch of
MiXedCaSE tables  that I have to do that with.

Ross

-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005


Re: [HACKERS] Is "isolation" a restricted word?

От
"G. Anthony Reina"
Дата:
"Ross J. Reedstrom" wrote:

> Yup - here it is in pgsql/src/backend/parser/keywords.c:

Thanks Reed. I'll just change it since it's restricted.

-Tony




Re: [HACKERS] Is "isolation" a restricted word?

От
Thomas Lockhart
Дата:
> > reason, I am getting a parser error:
> > => create table cell ( isolation text );
> > ERROR:  parser: parse error at or near "isolation"
> > This table had no problems previously; has the word isolation been used
> > somewhere else as a SQL word? I can't think of why else I am having
> > problems with the table (the syntax appears to be correct).
> Yup - here it is in pgsql/src/backend/parser/keywords.c:
> This table should in fact be the definitive guide, since it's the array
> that the parser uses ;-)

It is a definitive guide for keywords, but is a superset of keywords
which are allowed as column names. In this case, ISOLATION was added
to the syntax but was not added to gram.y as an allowed column id.
Edit src/backend/parser/gram.y, look for the line starting with
"ColId:", and add ISOLATION to the already long list of keywords which
follows.

I'll make the change for v6.6; it could perhaps be used for v6.5.3
also, if there is one.

> And it's mentioned in the HISTORY file as part of the MVCC
> changes. They're a couple of these 'gotcha' words that are part of
> the SQL standard, but hadn't yet been implemented before 6.5 that have
> tripped up people.

Keep reporting them, because in some cases we can allow them even
though they may be a reserved word in SQL92. But that can lead to
portability problems, not that I can imagine anyone moving away from
Postgres ;)
                      - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


Re: [HACKERS] Is "isolation" a restricted word?

От
Thomas Lockhart
Дата:
> > > This table had no problems previously; has the word isolation been used
> > > somewhere else as a SQL word?
> > And it's mentioned in the HISTORY file as part of the MVCC
> > changes. They're a couple of these 'gotcha' words that are part of
> > the SQL standard, but hadn't yet been implemented before 6.5 that have
> > tripped up people.

btw, it *is* documented as an SQL92 reserved word and a Postgres
reserved word in the big docs in the chapter on "Syntax".
                      - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California