Re: Bug with view definitions?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, Justin Clift <jc(at)telstra(dot)net>, PostgreSQL Hackers Mailing List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug with view definitions?
Date: 2004-07-01 17:47:11
Message-ID: 28975.1088704031@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org> writes:
> On Thu, 1 Jul 2004, Bruno Wolff III wrote:
>> If DISTINCT ON or LIMIT was used in inner select, then the ORDER BY would
>> be relevant; so you can't just blindly remove ORDER BY when it is part of
>> a union.

> Of course, but in this case with this view there wasn't any such. It can
> still be usable since we know how pg sorts and this is an internal query.

> The real bug is in the pretty printer anyway. I was just surprised to see
> the order by inside the union and not on the outside where it belongs (and
> just moving it out in this case wont produce exactly the same result).

Actually, if you look at the source code (information_schema.sql) there
is no ORDER BY in it, only a DISTINCT. The ORDER BY gets added by the
parser to help implement the DISTINCT. Sooner or later we should look
at suppressing the added ORDER BY when displaying the view.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2004-07-01 17:55:20 Re: possibly updating techdocs; mysql2pgsql on gborg
Previous Message Tom Lane 2004-07-01 17:30:59 Re: Adding column comment to information_schema.columns