Re: Simulate count result are distinct between 8.3 and 8.4

Поиск
Список
Период
Сортировка
От Shoaib Mir
Тема Re: Simulate count result are distinct between 8.3 and 8.4
Дата
Msg-id bf54be870908121707g83ff3c2kceeb28f35785f726@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Simulate count result are distinct between 8.3 and 8.4  (Chris <dmagick@gmail.com>)
Ответы Re: Simulate count result are distinct between 8.3 and 8.4
Список pgsql-general
On Thu, Aug 13, 2009 at 9:37 AM, Chris <dmagick@gmail.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/

В списке pgsql-general по дате отправления:

Предыдущее
От: David Kerr
Дата:
Сообщение: Re: Looping through string constants
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: trouble building pgbench on CentOS 5.3: /usr/bin/ld: cannot find -lpgport