Re: bug with dump sql to recreate view

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Laura Moloney <lmoloney(at)theradex(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: bug with dump sql to recreate view
Date: 2003-04-07 17:16:58
Message-ID: 20030407101523.U35893-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 7 Apr 2003, Laura Moloney wrote:

> The sql that created the original view was:
> CREATE VIEW INCUNRESOLVEDV1 AS
> SELECT DISTINCT TRACKID FROM INCIDENT
> WHERE STATUS = 'o'
> EXCEPT
> SELECT DISTINCT TRACKID FROM INCIDENT_DETAIL
> WHERE LOWER(RESOLVEDYN) = 'y'
> ;
>
> The sql that was generated from pgdump was:
> CREATE VIEW "incunresolvedv1" as
> SELECT DISTINCT incident.trackid FROM incident
> WHERE (incident.status = 'o'::"varchar")
> ORDER BY incident.trackid
> EXCEPT
> SELECT DISTINCT incident_detail.trackid FROM incident_detail
> WHERE (lower((incident_detail.resolvedyn)::text) = 'y'::text)
> ORDER BY incident_detail.trackid;
>
> I found that if I removed the order by clauses, then the sql would execute
> correctly.
>
> I also tried to run the pgdump sql on our 7.2.3 server to see if it had been
> resolved in a newer release, but the same error occurred.
>
> Hope my explanation was clear enough. I can certainly get around it my
> running the original SQL, but I thought you might be interested in it if in fact
> it was a bug.

It seems to have been a bug in pg_dump on 7.1.x that dumped an invalid
query. Current pg_dump dumps the two selects with parentheses around them
which is loadable.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Hubert Palme 2003-04-07 21:10:49 Dump and Restore of Database by User
Previous Message Peter Eisentraut 2003-04-07 17:05:30 Re: Psql 'Expanded display (\x)' behaviour