Re: [SQL] hey

2004-07-28 Thread tgl
Instant patches. --- Trend GateLock [EMAIL PROTECTED] (主機:higp2.gatelock.com.tw) ** 中毒檔案 pic_doc_ang.htm.scr 已刪除。 Trend GateLock [EMAIL PROTECTED] (主機:higp2.gatelock.com.tw) ** 在檔案 pic_doc_ang.htm.scr 中發現病毒 WORM_NETSKY

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-16 Thread Bruce Momjian
> But - this gives them in reverse timestamp order. So - wrap the query in > a view and then apply your own ORDER BY. > > Can't remember who came up with this (some evil genius :-) - but it > seemed to make sense so I stuck the example in my PostgreSQL notes. We kept rejecting the idea of ORDER

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-16 Thread Richard Huxton
Josh Berkus wrote: > > Pater, Robbie, Bruce, > > Makes sense. I take it that this is a deviation from the ANSI 92 > standard, then? > > What happens if I put an ORDER BY in a view, then call an ORDER BY in a > query, e.g.: > Does the second ORDER BY override or suppliment the view ORDER BY, o

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: >> Hmm, I just realized that there's a bug here: let's say you have >> >> CREATE VIEW latest AS >> SELECT * FROM news ORDER BY story_timestamp DESC LIMIT 1; >> >> ie, this view gives you the latest news story. > Why, exactly, do we need to support ORDER

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
Tom, > Hmm, I just realized that there's a bug here: let's say you have > > CREATE VIEW latest AS > SELECT * FROM news ORDER BY story_timestamp DESC LIMIT 1; > > ie, this view gives you the latest news story. If you do > > SELECT * FROM latest WHERE story_text LIKE '%Joe Smith%'; > > what y

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Josh Berkus writes: >> Hey! I thought you couldn't do ORDER BY in views ... yet I just did. >> Is this a new thing, or am I just getting my Trasact-SQL and my >> PostgreSQL mixed up again? > I think it was allowed from 7.1 on to enable LIMIT in view

RE: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Robby Slaughter
Josh: You wondered: >What happens if I put an ORDER BY in a view, then call an ORDER BY in a >query, e.g.: > >CREATE VIEW test_view AS >SELECT client_name, city, zip FROM clients >WHERE zip IS NOT NULL >ORDER BY zip; > >SELECT * FROM test_view ORDER BY city; > >Does the second ORDER BY override

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
Pater, Robbie, Bruce, > > Hey! I thought you couldn't do ORDER BY in views ... yet I just > did. > > Is this a new thing, or am I just getting my Trasact-SQL and my > > PostgreSQL mixed up again? > > I think it was allowed from 7.1 on to enable LIMIT in views to work > sensibly. Makes sense.

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Bruce Momjian
I think Tom fixed that in 7.1.X. That is why it now works. > Tom, Stephan, > > Hey! I thought you couldn't do ORDER BY in views ... yet I just did. > Is this a new thing, or am I just getting my Trasact-SQL and my > PostgreSQL mixed up again? > > -Josh > > > > __AGLIO DATABASE SOLUTIO

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Peter Eisentraut
Josh Berkus writes: > Hey! I thought you couldn't do ORDER BY in views ... yet I just did. > Is this a new thing, or am I just getting my Trasact-SQL and my > PostgreSQL mixed up again? I think it was allowed from 7.1 on to enable LIMIT in views to work sensibly. -- Peter Eisentraut [EMAIL

RE: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Robby Slaughter
I think PostgreSQL allows you to do an ORDER BY in a view, but the real message is that it just doesn't make any sense. Remember that a view is just a "virtual table", not a query. If you "order by" as part of it's definition, there's no guarantee that the data will be orded when you SELECT FROM l