Simulate count result are distinct between 8.3 and 8.4

From: Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com>
To: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Simulate count result are distinct between 8.3 and 8.4
Date: 2009-08-12 21:46:02
Message-ID: f205bb120908121446q598d54f2s61aa031ab1eee1ab@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi people!

I have this test query to simulate rownums in 8.3:

SELECT
(select count(i)+1 from prueba
where i < xi.i
) as rownum, i, p
FROM prueba xi limit 5;

Devuelve , que esta bien:
1;1;"299361"
2;2;"421127"
3;3;"166284"
4;4;"458945"
5;5;"81619"

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)

synchronize_seqscan are on in both engines.

I only want to know why is this difference...

--
Emanuel Calvo Franco
Database consultant at:
www.siu.edu.ar
www.emanuelcalvofranco.com.ar

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Kerr 2009-08-12 22:55:51 Looping through string constants
Previous Message Daniel Verite 2009-08-12 20:57:54 Re: comparing NEW and OLD (any good this way?)