From: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
---|---|
To: | Oleg Serov <serovov(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Crazy query plan. |
Date: | 2009-11-14 05:20:35 |
Message-ID: | 4AFE3E23.1060304@postnewspapers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Sorry for the multiple replies-to-self, but this seemed worth
specifically noting: the expansion also results in multiple calls to
tuple-returning functions, even functions marked VOLATILE. For example:
CREATE OR REPLACE FUNCTION expandtest(INTEGER) RETURNS test AS $$
DECLARE
rec test;
BEGIN
RAISE NOTICE 'expandtest(%)',$1;
rec.a := $1;
rec.b := $1;
rec.c := $1;
rec.d := $1;
RETURN rec;
END;
$$ LANGUAGE 'plpgsql' STRICT VOLATILE;
craig=# SELECT (expandtest(1)).*;
NOTICE: expandtest(1)
NOTICE: expandtest(1)
NOTICE: expandtest(1)
NOTICE: expandtest(1)
a | b | c | d
---+---+---+---
1 | 1 | 1 | 1
(1 row)
I don't know if that's intended behaviour or not, but I certainly find
it very _surprising_ behaviour, especially given the otherwise
equivalent translation:
craig=# SELECT t.* FROM expandtest(1) t;
NOTICE: expandtest(1)
a | b | c | d
---+---+---+---
1 | 1 | 1 | 1
(1 row)
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2009-11-14 15:41:00 | Re: Re: BUG #5065: pg_ctl start fails as administrator, with "could not locate matching postgres executable" |
Previous Message | Craig Ringer | 2009-11-14 04:42:27 | Re: Crazy query plan. |