Re: Plan invalidation vs temp sequences

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Plan invalidation vs temp sequences
Date: 2007-10-11 07:44:28
Message-ID: 470DD45C.3060706@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2007-10-11 08:10:03 Re: quote_literal with NULL
Previous Message Marko Kreen 2007-10-11 07:13:25 Re: Skytools committed without hackers discussion/review