pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dylan Adams <dadams@bybaxter.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6049: Can't load dumped view with VALUES and ORDER BY
Date: Thu, 2 Jun 2011 20:22:41 GMT
Message-ID: <201106022022.p52KMfFL044245@wwwmaster.postgresql.org> (raw)


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;



view thread (2+ messages)  latest in thread

Message-ID: <201106022022.p52KMfFL044245@wwwmaster.postgresql.org>
Permalink:  ../201106022022.p52KMfFL044245@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201106022022.p52KMfFL044245@wwwmaster.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-bugs@postgresql.org
  Cc: dadams@bybaxter.com
  Subject: Re: BUG #6049: Can't load dumped view with VALUES and ORDER BY
  In-Reply-To: <201106022022.p52KMfFL044245@wwwmaster.postgresql.org>
  References: <201106022022.p52KMfFL044245@wwwmaster.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