pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6049: Can't load dumped view with VALUES and ORDER BY
2+ messages / 2 participants
[nested] [flat]

* BUG #6049: Can't load dumped view with VALUES and ORDER BY
@ 2011-06-02 20:22  Dylan Adams <dadams@bybaxter.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Dylan Adams @ 2011-06-02 20:22 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      6049
Logged by:          Dylan Adams
Email address:      dadams@bybaxter.com
PostgreSQL version: 8.4.4
Operating system:   Linux (Fedora 12)
Description:        Can't load dumped view with VALUES and ORDER BY
Details: 

If you create a view based on a VALUES statement with an ORDER BY clause,
the SQL produced by pg_dump can't be loaded back into the database.

$ createdb testdb
$ psql -c "CREATE VIEW test_view AS VALUES (1), (2), (3) ORDER BY 1; -- or
ORDER BY column1" testdb
CREATE VIEW
$ pg_dump -t test_view testdb > test_view.dump
$ psql -c "DROP VIEW test_view;" testdb
DROP VIEW
$ psql -f test_view.dump testdb
SET
SET
SET
SET
SET
SET
psql:test_view.dump:18: ERROR:  invalid reference to FROM-clause entry for
table "*VALUES*"
LINE 2:     VALUES (1), (2), (3) ORDER BY "*VALUES*".column1;
                                          ^
HINT:  There is an entry for table "*VALUES*", but it cannot be referenced
from this part of the query.
psql:test_view.dump:21: ERROR:  relation "public.test_view" does not exist

Here's the definition that gets dumped:

CREATE VIEW test_view AS
    VALUES (1), (2), (3) ORDER BY "*VALUES*".column1;



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

* Re: BUG #6049: Can't load dumped view with VALUES and ORDER BY
@ 2011-06-04 19:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Dylan Adams <dadams@bybaxter.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2011-06-04 19:50 UTC (permalink / raw)
  To: Dylan Adams <dadams@bybaxter.com>; +Cc: pgsql-bugs

"Dylan Adams" <dadams@bybaxter.com> writes:
> If you create a view based on a VALUES statement with an ORDER BY clause,
> the SQL produced by pg_dump can't be loaded back into the database.

I've applied a patch for this.  Thanks for the report!

			regards, tom lane



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


end of thread, other threads:[~2011-06-04 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-06-02 20:22 BUG #6049: Can't load dumped view with VALUES and ORDER BY Dylan Adams <dadams@bybaxter.com>
2011-06-04 19:50 ` Tom Lane <tgl@sss.pgh.pa.us>

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