Re: 7.2.1: pg_dump of UNIONed VIEWs broken

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ian Morgan <imorgan(at)webcon(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: 7.2.1: pg_dump of UNIONed VIEWs broken
Date: 2002-04-22 14:56:05
Message-ID: 14926.1019487365@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ian Morgan <imorgan(at)webcon(dot)net> writes:
> The SQL for CREATE VIEW as output by pg_dump generates an error, because the
> appropriate nesting of SELECTs with parentheses is missing:

Hmm. You shouldn't *need* parentheses in most cases ...

> CREATE VIEW "agents" as (
> (
> SELECT DISTINCT
> employees.contact_id
> FROM
> employees
> ORDER BY
> employees.contact_id
> )
> UNION
> (
> SELECT DISTINCT
> contractors.contact_id
> FROM
> contractors
> ORDER BY
> contractors.contact_id
> )
> );

although I suppose this is a counterexample. Would it help any to point
out that ORDER BY inside an arm of a UNION is a complete waste of
cycles? That's probably why it didn't occur to anyone to test this.

BTW, the SELECT DISTINCTs are also a waste of cycles, since UNION will
do that anyway.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-04-22 15:00:49 Re: Bug #638: Buggy select statment with numeric
Previous Message Stephan Szabo 2002-04-22 14:29:11 Re: Bug #638: Buggy select statment with numeric