Re: pg_class_aclcheck: relation [oid] not found... - Mailing list pgsql-bugs

From Tom Lane
Subject Re: pg_class_aclcheck: relation [oid] not found...
Date
Msg-id 11644.1053999560@sss.pgh.pa.us
Whole thread Raw
In response to pg_class_aclcheck: relation [oid] not found...  (Sean Chittenden <sean@chittenden.org>)
Responses Re: pg_class_aclcheck: relation [oid] not found...
List pgsql-bugs
Sean Chittenden <sean@chittenden.org> writes:
> CREATE FUNCTION s.f()
>         RETURNS BIGINT
>         EXTERNAL SECURITY DEFINER
>         AS '
> BEGIN
>         EXECUTE ''CREATE LOCAL TEMP TABLE t (
>                 a TEXT NOT NULL,
>                 b TEXT
>         ) WITHOUT OIDS ON COMMIT DROP;'';
>         EXECUTE ''CREATE UNIQUE INDEX t_key_udx ON t(a);'';

>         INSERT INTO t (a, b) VALUES (''foo''::TEXT, ''bar''::TEXT);

This is not going to work more than once, because the INSERT caches
a plan that refers to the first-time-through temp table.

You could put the INSERT into an EXECUTE as well.  Or use a different
PL language that doesn't cache plans.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Mendola Gaetano"
Date:
Subject: Re: Bug in sequence dependency checking
Next
From: Serge Obeuf
Date:
Subject: Question to You