Hello Hackers,
I see the very strange behaviour with the following set of queries:
wsdb=# select na,nb, na::double precision as da, nb::double precision as db from ( select random()::numeric as
na,random()::numericas nb from generate_series(1,2)) as xx; na | nb | da |
db
-------------------+-------------------+-------------------+------------------- 0.756045001445359 | 0.505602368389071 |
0.283893094995941| 0.160685719065687 0.792114335015469 | 0.416411793053342 | 0.342387438445532 | 0.531201674850286
(2 rows)
On my understanding that should produce the "na" column equal to "da" ?
When I do the same with the select from the table the result is similar:
wsdb=# select na,nb, na::double precision as da, nb::double precision as db from ( select random()::numeric as
na,random()::numericas nb from pg_proc) as xx; na | nb | da |
db
-----------------------+-----------------------+----------------------+---------------------- 0.125243402610181 |
0.620239329347498 | 0.64666960465101 | 0.257827353318141 0.934299875951512 | 0.0322264223509591 |
0.96565025298188| 0.0439542480949099
........
But when I limit the select, I get the expected result.
wsdb=# select na,nb, na::double precision as da, nb::double precision as db from ( select random()::numeric as
na,random()::numericas nb from pg_proc limit 2) as xx; na | nb | da |
db
-------------------+-------------------+-------------------+------------------- 0.543030349324937 | 0.925069289712733 |
0.543030349324937| 0.925069289712733 0.934251406665077 | 0.292522935332974 | 0.934251406665077 | 0.292522935332974
(2 rows)
Is that a bug, or I'm missing something ?
PG version is 8.1.4 or 8.2dev.
Regards, Sergey
*******************************************************************
Sergey E. Koposov
Max Planck Institute for Astronomy/Sternberg Astronomical Institute
Tel: +49-6221-528-349
Web: http://lnfm1.sai.msu.ru/~math
E-mail: math@sai.msu.ru