Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group