Hello

I tested some usage of LATERAL clause, and I found so LATERAL doesn't
respects difference between VOLATILE and IMMUTABLE functions.

Is this behave expected?

-- unexpected
postgres=# select * from generate_series(1,3) g(v), LATERAL (SELECT random()) x;
;
 v │      random
───┼──────────────────
 1 │ 0.63025646051392
 2 │ 0.63025646051392
 3 │ 0.63025646051392
(3 rows)


-- expected
postgres=# select * from generate_series(1,3) g(v), LATERAL (SELECT
random() - v + v) x;
 v │     ?column?
───┼───────────────────
 1 │ 0.381548477802426
 2 │ 0.762988060247153
 3 │ 0.181648664642125
(3 rows)


Regards

Pavel Stehule

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to