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

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Gang Chen <gchen@s2now.com>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2025-04-16T16:43:12Z
Lists: pgsql-bugs
On Mon, Apr 14, 2025 at 08:55:04AM +0000, Gang Chen wrote:
> Hello,
> 
> But isn't that kind of strange? If it's just a very simple view, first of all,
> referencing itself would result in an infinite recursion error. Also, it
> doesn't seem to have any practical use. Secondly, during pg_upgrade or backup
> and restore processes, it might introduce unnecessary errors and additional
> handling procedures.

You are right, but disallowing only that setup would be confusing. To
keep the user interface simple, we should either allow a general class
of things or disallow them.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.