| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)ar> |
| Cc: | "'Scott Marlowe'" <scott(dot)marlowe(at)gmail(dot)com>, "'Patrick Scharrenberg'" <pittipatti(at)web(dot)de>, pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: using calculated column in where-clause |
| Date: | 2008-06-19 18:38:24 |
| Message-ID: | 19546.1213900704@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
"Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)ar> writes:
> -- In this case function test is called only once:
> pg=# select res[0] as sum, res[1] as prod, res[2] as dif from
> pg-# (select (test(1, 2))::integer[] as res) t ;
That's an implementation artifact, not a guaranteed behavior;
if you change the example a bit you'll find multiple calls
happening.
(In recent releases you'd actually have a better chance of
not having multiple calls if you'd declared it volatile
instead of immutable.)
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Kovacs | 2008-06-20 05:51:50 | "TZ"/"tz" not supported |
| Previous Message | Fernando Hevia | 2008-06-19 18:32:53 | Re: using calculated column in where-clause |