Re: Bug #545: Keyword USER not detected in CREATE VIEW

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: lockhart(at)fourpalms(dot)org
Cc: avi(at)argo(dot)co(dot)il, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #545: Keyword USER not detected in CREATE VIEW
Date: 2001-12-28 21:17:35
Message-ID: 14941.1009574255@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thomas Lockhart <lockhart(at)fourpalms(dot)org> writes:
> avi=> create view z as select x as user from y;
> My expected result: an error message in CREATE VIEW
>> This is not a bug, it is intentional behavior. "AS" names are not
>> restricted to be non-reserved words.

> Sure, but his point is that the resulting view has a column which is
> named "user" and which is not directly accessible without using double
> quotes.

Yeah, but what would you do about it? The identical situation can be
created in at least three ways:

create table foo ("user" varchar);

create view foo as select x as "user" from y;

create view foo as select x as user from y;

I would certainly object to emitting a warning notice in the first two
cases. There might be some merit in warning about the third, but I don't
see a reasonable way to distinguish it from the others.

A not-unrelated point: would you also have the system warn about

create table foo ("Foo" varchar);

Here again the column cannot be named without using quotes. But I'd
see issuing a warning about it as unwarranted nannyism.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Lockhart 2001-12-28 21:40:57 Re: Bug #545: Keyword USER not detected in CREATE VIEW
Previous Message Thomas Lockhart 2001-12-28 21:07:49 Re: Bug #545: Keyword USER not detected in CREATE VIEW