Skip site navigation (1) Skip section navigation (2)

Re: pg_dump fails for views with UNION and SELECT DISTINCT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sam O'Connor" <sam(at)panviva(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_dump fails for views with UNION and SELECT DISTINCT
Date: 2002-06-14 22:42:39
Message-ID: 9677.1024094559@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Sam O'Connor" <sam(at)panviva(dot)com> writes:
> If I create a view like this:
> CREATE VIEW v AS
> SELECT i FROM a
> UNION
> SELECT DISTINCT i FROM b

> It functions as expected but it causes pg_dump to produce
> bad output. "ORDER BY b.i" is added to the view definition.

This appears to be fixed already in current sources --- the problem
is the lack of parentheses around the arms of the UNION.  There's
a difference between
	SELECT foo UNION SELECT bar ORDER BY baz;
and
	SELECT foo UNION (SELECT bar ORDER BY baz);
and the rule dumper was not being careful about it :-(

I'll see about backpatching this change for 7.2.2.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2002-06-15 19:31:36
Subject: Re: PgLargeObject bug
Previous:From: Lamar OwenDate: 2002-06-14 15:31:29
Subject: Re: Bug #692: corrupt rpms

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group