| From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Subject: | LATERAL and VOLATILE functions |
| Date: | 2012-12-15 21:47:48 |
| Message-ID: | CAFj8pRDoSzrh6zwDcc1_cLk9zg_QKsCC9yRDhMG=P0SJpZwoLQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2012-12-15 21:48:08 | Re: Set visibility map bit after HOT prune |
| Previous Message | Pavan Deolasee | 2012-12-15 18:53:44 | Re: Makefiles don't seem to remember to rebuild everything anymore |