Thomas Lockhart <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to