pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13776: Views with nested composite attributes can break pg_dump
3+ messages / 3 participants
[nested] [flat]

* BUG #13776: Views with nested composite attributes can break pg_dump
@ 2015-11-15 16:58  pythonesque@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: pythonesque@gmail.com @ 2015-11-15 16:58 UTC (permalink / raw)
  To: 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.



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13776: Views with nested composite attributes can break pg_dump
@ 2015-11-15 19:42  Tom Lane <tgl@sss.pgh.pa.us>
  parent: pythonesque@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2015-11-15 19:42 UTC (permalink / raw)
  To: pythonesque@gmail.com; +Cc: pgsql-bugs

pythonesque@gmail.com writes:
> # 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;

Fixed, thanks for the report!

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13776: Views with nested composite attributes can break pg_dump
@ 2015-11-15 19:57  Joshua Yanovski <pythonesque@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Joshua Yanovski @ 2015-11-15 19:57 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

I actually found another place that it also affects (RowCompareExpr)
but that should be a two-line fix with the new function.

On Sun, Nov 15, 2015 at 11:42 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> pythonesque@gmail.com writes:
>> # 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;
>
> Fixed, thanks for the report!
>
>                         regards, tom lane



-- 
Josh


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2015-11-15 19:57 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-11-15 16:58 BUG #13776: Views with nested composite attributes can break pg_dump pythonesque@gmail.com
2015-11-15 19:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-11-15 19:57   ` Joshua Yanovski <pythonesque@gmail.com>

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