Thread: 'order by' clause lost when creating view
When I created a view in pgAdmin II using a SELECT statement that includes an ORDER BY clause, pgAdmin seemed to ignore that clause. The generated SQL shown with the view properties clearly does not have that clause, even though the original SQL as shown in the description area does have that clause. The same view definition works fine when I create it directly in psql. Why does pgAdmin translate the view definition SELECT statement into a different form, rather than using it verbatim? This is happening in version 1.1 build 26. -- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA
----Original Message----- >From: fred@ontosys.com >To: pgadmin-support@postgresql.org >Cc: >Subject: [pgadmin-support] 'order by' clause lost when creating view >Reply-To: >Date: 28 August 2001 13:19 > >When I created a view in pgAdmin II using a SELECT statement that >includes an ORDER BY clause, pgAdmin seemed to ignore that clause. >The generated SQL shown with the view properties clearly does not have >that clause, even though the original SQL as shown in the description >area does have that clause. The same view definition works fine when >I create it directly in psql. > >Why does pgAdmin translate the view definition SELECT statement into a >different form, rather than using it verbatim? It shouldn't. I don't have the code near me until tomorrow, but as far as I can recall nothing is done with the view definition at all - there is no reason for pgAdmin to parse the SQL so it doesn't. I'll take a look tomorrow and see if anything else might be causing the symptoms you're seeing. Regards, Dave
> -----Original Message----- > From: fred@ontosys.com [mailto:fred@ontosys.com] > Sent: 28 August 2001 13:17 > To: pgadmin-support@postgresql.org > Subject: [pgadmin-support] 'order by' clause lost when creating view > > > When I created a view in pgAdmin II using a SELECT statement > that includes an ORDER BY clause, pgAdmin seemed to ignore > that clause. The generated SQL shown with the view properties > clearly does not have that clause, even though the original > SQL as shown in the description area does have that clause. > The same view definition works fine when I create it directly in psql. > > Why does pgAdmin translate the view definition SELECT > statement into a different form, rather than using it verbatim? > > This is happening in version 1.1 build 26. Fred, I looked at this as promised and the view definition you enter is passed verbatim to the odbc driver via ADO's Connection.Execute method (what you see in the logs will be stripped of CRLFs though). Can you send me an example of what's going wrong for you please - I'd need the definitions of the underlying tables/functions and the view you are trying to create. Thanks, Dave.