Re: Bug with view definitions? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bug with view definitions?
Date
Msg-id 8944.1088739304@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bug with view definitions?  (Justin Clift <jc@telstra.net>)
List pgsql-hackers
Justin Clift <jc@telstra.net> writes:
> Tom Lane wrote:
>> 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.

> If someone fixes this can we make sure it goes into 7.4.4 as well (if 
> it's not a drastic code change)?

The thoughts I had for fixing it involved adding a field to SortClause
nodes to show whether they came from an actual user clause or were added
by the parser.  This would be an initdb-forcing change and thus
unsuitable for a backpatch to 7.4 ...

> It's not a data corrupting bug but it's stopping view definitions from 
> "working as advertised" which is bad if you're used to being able to 
> rely on them.  :-/

No, the pretty-printer's failure to add parens here is a different bug.
That we could fix without a data structure change.  It's just a matter
of figuring out exactly where it's being too permissive about dropping
parens.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: Bug with view definitions?
Next
From: Tom Lane
Date:
Subject: Re: Bug with view definitions?