Tom Lane wrote:
> ... We might want to do that someday --- in particular,
> if we ever try to extend the plan inval mechanism to react to
> redefinitions of non-table objects, we'd likely need some such thing
> anyway. I'm disinclined to try to do it for 8.3 though. The use-case
> for temp sequences seems a bit narrow and there are several workarounds
> (see followups to bug report), so I'm feeling this is a
> fix-some-other-day kind of issue.
Agreed. I was a bit worried about this kind of usage:
CREATE OR REPLACE FUNCTION testfunc(val int) RETURNS int AS $$
DECLARE
BEGIN
CREATE TEMPORARY SEQUENCE tempseq;
CREATE TEMPORARY TABLE inttable (key integer DEFAULT
nextval('tempseq'), data text);
INSERT INTO inttable (data) VALUES ('foo');
DROP TABLE inttable;
DROP SEQUENCE tempseq;
return 1;
END;
$$ LANGUAGE plpgsql;
but that seems to work, because creating/dropping the temp table
triggers the plan invalidation.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match