>----- Original Message ----
>From: Andrew Sullivan <ajs@crankycanuck.ca>
>To: pgsql-sql@postgresql.org
>Sent: Wednesday, May 30, 2007 7:39:18 PM
>Subject: Re: [SQL] slow query execution
>
>On Wed, May 30, 2007 at 10:03:16AM -0700, Trigve Siver wrote:
>> Hi, Thanks for reply, As you have mentioned I need to get row
>> numbers for my query, so when I make some other query with same
>> data I will know which row number has a particular ID.
>
>Oh, wait. If _that's_ your plan, then this will never work. The
>data could change, and your row numbers would come out wrong.
>What do you need "row numbers" for anyway? The very idea is inimical
>to SQL, because the data is fundamentally unordered.
I want to do it only for some queries. So when I need query like that "SELECT * from t1"
I need to add row_numbers there. So I will have "query with row_numbers" (where row_numbers
are row numbers of my virtual list view). Then when I perform search I also get row_numbers for IDs of search result
andI can highlight items in my list view. I haven't found other solution that met my requirements.
I want also do it with cursors.
[...]
>I think there's some nifty way to get generate_series to do this too,
>but I don't know it offhand (generating row numbers sounds to me like
>a bad idea, so I don't do it).
I have tried with generate_series but without success.
thanks
Trigve
____________________________________________________________________________________Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz