Re: BUG #18892: When the view already exists, CREATE OR REPLACE VIEW does not check whether the table exists.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #18892: When the view already exists, CREATE OR REPLACE VIEW does not check whether the table exists.
Дата
Msg-id CAKFQuwaczG7zLiutpk7WzZc-8v2avugcbNq0OcLZbk+0EutWSA@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #18892: When the view already exists, CREATE OR REPLACE VIEW does not check whether the table exists.  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18892: When the view already exists, CREATE OR REPLACE VIEW does not check whether the table exists.
回复: BUG #18892: When the view already exists, CREATE OR REPLACE VIEW does not check whether the table exists.
Список pgsql-bugs
On Sat, Apr 12, 2025 at 11:59 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      18892
Logged by:          Gavin
Email address:      gchen@s2now.com
PostgreSQL version: 16.8
Operating system:   Red Hat Enterprise Linux release 9.5
Description:       

 
However, as demonstrated in my test demo, when
the view already exists, running CREATE OR REPLACE VIEW does not check
whether the table exists.

Because of the whole shared namespace setup it would be impossible for a table of that name to exist when executing the "or replace" branch since the view being replaced occupies that name within the namespace.  Any check for an actual table would return false.  And "or replace" only happens if a view of that name exists.

Kirill's answer is correct; though it is a bit annoying that "create view" cannot detect the infinite recursion inherent in its body.

David J.

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