Dump/restore of views containing select distinct fails - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Dump/restore of views containing select distinct fails
Date
Msg-id Pine.LNX.4.30.0104131320270.945-100000@peter.localdomain
Whole thread Raw
Responses Re: Dump/restore of views containing select distinct fails
List pgsql-hackers
=> create view testview as select relname, 'Constant'::text from pg_class;

=> \d testview      View "testview"Attribute | Type | Modifier
-----------+------+----------relname   | name |?column?  | text |
View definition: SELECT DISTINCT pg_class.relname, 'Constant'::text FROM
pg_class ORDER BY pg_class.relname, 'Constant'::text;

Note how the order by clause is not valid SQL.  You get

ERROR:  Non-integer constant in ORDER BY

I suppose the ORDER BY clause appears because of some weird query parse
tree hackery and is not easy to get rid of.  Maybe using column numbers
instead of spelling out the select list again would work?

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: Hand written parsers
Next
From: Thomas Lockhart
Date:
Subject: Re: Call for platforms