pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix CREATE VIEW to allow zero-column views.
Date: Sun, 17 Feb 2019 17:37:52 +0000
Message-ID: <E1gvQO0-00030Y-4f@gemulon.postgresql.org> (raw)

Fix CREATE VIEW to allow zero-column views.

We should logically have allowed this case when we allowed zero-column
tables, but it was overlooked.

Although this might be thought a feature addition, it's really a bug
fix, because it was possible to create a zero-column view via
the convert-table-to-view code path, and then you'd have a situation
where dump/reload would fail.  Hence, back-patch to all supported
branches.

Arrange the added test cases to provide coverage of the related
pg_dump code paths (since these views will be dumped and reloaded
during the pg_upgrade regression test).  I also made them test
the case where pg_dump has to postpone the view rule into post-data,
which disturbingly had no regression coverage before.

Report and patch by Ashutosh Sharma (test case by me)

Discussion: https://postgr.es/m/CAE9k0PkmHdeSaeZt2ujnb_cKucmK3sDDceDzw7+d5UZoNJPYOg@mail.gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b355be443b74d2749db00242d068fabc2df39f27

Modified Files
--------------
src/backend/commands/view.c                |  5 -----
src/test/regress/expected/create_view.out  | 10 ++++++++++
src/test/regress/expected/rules.out        |  8 ++++++++
src/test/regress/expected/sanity_check.out |  1 +
src/test/regress/sql/create_view.sql       | 12 ++++++++++++
5 files changed, 31 insertions(+), 5 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1gvQO0-00030Y-4f@gemulon.postgresql.org>
Permalink:  ../E1gvQO0-00030Y-4f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gvQO0-00030Y-4f@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix CREATE VIEW to allow zero-column views.
  In-Reply-To: <E1gvQO0-00030Y-4f@gemulon.postgresql.org>
  References: <E1gvQO0-00030Y-4f@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox