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

From Sean Chittenden
Subject pg_class_aclcheck: relation [oid] not found...
Date
Msg-id 20030526231050.GY71079@perrin.int.nxad.com
Whole thread Raw
Responses Re: pg_class_aclcheck: relation [oid] not found...
List pgsql-bugs
Howdy.  There's a bug in the handling of clean up temp tables.  It
seems as though there's a missing call to ReleaseSysCache around line
4237 of backend/commands/tablecmds.c... though adding such a call
doesn't solve the problem.  Hrm.  This one's pretty easy to reproduce
and there doesn't seem to be any mystery about how to trigger it:

CREATE SCHEMA s;
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);
        IF NOT FOUND THEN
                RAISE EXCEPTION ''Unable to insert t'';
        END IF;

        RETURN 0::BIGINT;
END;
' LANGUAGE 'plpgsql';

BEGIN;
SELECT s.f();
COMMIT;
BEGIN;
SELECT s.f();
COMMIT;

And the output:

test=3D# BEGIN;
BEGIN
test=3D# SELECT s.f();
 f
---
 0
(1 row)

test=3D# COMMIT;
COMMIT
test=3D# BEGIN;
BEGIN
test=3D# SELECT s.f();
ERROR:  pg_class_aclcheck: relation 2265016 not found
CONTEXT:  PL/pgSQL function f line 8 at SQL statement


What bothers me about this, however, is that the functional equivalent
performed outside of a pl/pgsql function works which leads me to
believe that it's a pl/pgsql problem:

BEGIN;
CREATE LOCAL TEMP TABLE t (
       a TEXT NOT NULL,
       b TEXT
) WITHOUT OIDS ON COMMIT DROP;
CREATE UNIQUE INDEX t_key_udx ON t(a);

INSERT INTO t (a, b) VALUES ('foo'::TEXT, 'bar'::TEXT);
COMMIT;
BEGIN;
CREATE LOCAL TEMP TABLE t (
       a TEXT NOT NULL,
       b TEXT
) WITHOUT OIDS ON COMMIT DROP;
CREATE UNIQUE INDEX t_key_udx ON t(a);

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


Anyway, I hope this helps.  -sc

--=20
Sean Chittenden

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #928: server_min_messages (log_min_messages in CVS)
Next
From: "Mendola Gaetano"
Date:
Subject: Re: Bug in sequence dependency checking