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) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs