pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kristian Eide <kreide@online.no>
To: pgsql-sql@postgresql.org
Subject: Bug with dump/restore when using UNION and ORDER BY in views
Date: Sat, 3 Aug 2002 23:11:40 +0200
Message-ID: <036501c23b32$5c5149f0$6b97f181@speed> (raw)

There seems to be a bug when dumping a view which is a UNION of selects, one
of which has an ORDER BY. A pair of paranthesises around the select is
missing, and this cause a subsequent restore to fail. This is quite annoying
as the backup file must be manually edited before it can be restored, and I
would really appreciate a solution in a future version of Postgre.

This problem is still present in 7.2.1.

Example:

CREATE TABLE t (id INT);
CREATE VIEW v AS (SELECT id FROM t AS t1 ORDER BY id) UNION SELECT id FROM t
AS t2;

After a dump it looks like this:

CREATE VIEW "v" as SELECT t1.id FROM t t1 ORDER BY t1.id UNION SELECT t2.id
FROM t t2;

Which is not accepted by postgre.


Regards,

Kristian





view thread (6+ messages)  latest in thread

Message-ID: <036501c23b32$5c5149f0$6b97f181@speed>
Permalink:  ../036501c23b32$5c5149f0$6b97f181@speed/
Also on:    postgresql.org/message-id/036501c23b32$5c5149f0$6b97f181@speed

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kreide@online.no
  Subject: Re: Bug with dump/restore when using UNION and ORDER BY in views
  In-Reply-To: <036501c23b32$5c5149f0$6b97f181@speed>

* 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