| From: | Shoaib Mir <shoaibmir(at)gmail(dot)com> |
|---|---|
| To: | Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com> |
| Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Simulate count result are distinct between 8.3 and 8.4 |
| Date: | 2009-08-13 00:07:01 |
| Message-ID: | bf54be870908121707g83ff3c2kceeb28f35785f726@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Thu, Aug 13, 2009 at 9:37 AM, Chris <dmagick(at)gmail(dot)com> wrote:
> Emanuel Calvo Franco wrote:
>
>>
> But in 8.4 throws this:
>>
>> postgres=# SELECT
>> postgres-# (select count(i)+1 from prueba
>> postgres(# where i < xi.i
>> postgres(# ) as rownum, i, p
>> postgres-# FROM prueba xi limit 5;
>> rownum | i | p
>> --------+--------+--------
>> 168770 | 168763 | 908731
>> 168771 | 168764 | 640826
>> 168772 | 168765 | 571112
>> 168773 | 168766 | 992462
>> 168774 | 168767 | 992471
>> (5 filas)
>>
>
>
>
Why don't you make it simple and just use row_number() from 8.4... It can be
simplified as:
select row_number() over(), i, p from prueba limit 5;
--
Shoaib Mir
http://shoaibmir.wordpress.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2009-08-13 01:15:33 | Re: trouble building pgbench on CentOS 5.3: /usr/bin/ld: cannot find -lpgport |
| Previous Message | David Kerr | 2009-08-13 00:02:51 | Re: Looping through string constants |