"Sam O'Connor" <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to