Re: Crazy query plan.
| От | Craig Ringer |
|---|---|
| Тема | Re: Crazy query plan. |
| Дата | |
| Msg-id | 4AFE3E23.1060304@postnewspapers.com.au обсуждение |
| Ответ на | Re: Crazy query plan. (Craig Ringer <craig@postnewspapers.com.au>) |
| Список | 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)
В списке pgsql-bugs по дате отправления: