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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug #545: Keyword USER not detected in CREATE VIEW
Дата
Msg-id 14941.1009574255@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Bug #545: Keyword USER not detected in CREATE VIEW  (Thomas Lockhart <lockhart@fourpalms.org>)
Список pgsql-bugs
Thomas Lockhart <lockhart@fourpalms.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: Bug #545: Keyword USER not detected in CREATE VIEW
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: Bug #545: Keyword USER not detected in CREATE VIEW