BUG #13776: Views with nested composite attributes can break pg_dump - Mailing list pgsql-bugs

From pythonesque@gmail.com
Subject BUG #13776: Views with nested composite attributes can break pg_dump
Date
Msg-id 20151115165827.12771.5089@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #13776: Views with nested composite attributes can break pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13776
Logged by:          Joshua Yanovski
Email address:      pythonesque@gmail.com
PostgreSQL version: 9.4.5
Operating system:   Mac OS X 10.10.2
Description:

The below instructions provide a reproducible testcase.  Essentially, the
view definition is invalid SQL, so when you try to restore from a dump with
a view like this you get an error and can't proceed.  Currently I'm working
around it by using ROW(ROW(foo.*)) instead, but it seems to me that the
semantics there are slightly different since adding a column to foo won't
automatically add it to the view (though maybe this is desirable).

---

# CREATE TABLE foo ();
# CREATE TYPE bar AS (x foo);
# CREATE VIEW baz AS SELECT ROW(foo)::bar FROM foo;
# \d+ baz
View definition:
 SELECT ROW(foo.*)::bar AS "row"
   FROM foo;
# SELECT ROW(foo.*)::bar AS "row"
   FROM foo;
ERROR:  cannot cast type record to bar
LINE 1: SELECT ROW(foo.*)::bar AS "row"
                         ^
DETAIL:  Input has too few columns.

pgsql-bugs by date:

Previous
From: 'Bruce Momjian'
Date:
Subject: Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space
Next
From:
Date:
Subject: Re: BUG #13725: Logical Decoding - wrong results with large transactions and unfortunate timing