BUG #13776: Views with nested composite attributes can break pg_dump

From: pythonesque(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13776: Views with nested composite attributes can break pg_dump
Date: 2015-11-15 16:58:27
Message-ID: 20151115165827.12771.5089@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13776
Logged by: Joshua Yanovski
Email address: pythonesque(at)gmail(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message gtm 2015-11-15 18:02:58 installation of PostgreSQL 9.5 and 9.4 on Windows 32bit
Previous Message ofir.manor 2015-11-15 13:40:52 Re: BUG #13725: Logical Decoding - wrong results with large transactions and unfortunate timing