BUG #6049: Can't load dumped view with VALUES and ORDER BY

From: "Dylan Adams" <dadams(at)bybaxter(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6049: Can't load dumped view with VALUES and ORDER BY
Date: 2011-06-02 20:22:41
Message-ID: 201106022022.p52KMfFL044245@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 6049
Logged by: Dylan Adams
Email address: dadams(at)bybaxter(dot)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;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2011-06-02 22:11:21 Re: Unlogged tables cannot be truncated twice
Previous Message Tom Lane 2011-06-02 19:44:03 Re: UTC4115FATAL: the database system is in recovery mode