BUG #2124: Error "relation with OID ... does not exist" when using temporary table in function.

Поиск
Список
Период
Сортировка
От
Тема BUG #2124: Error "relation with OID ... does not exist" when using temporary table in function.
Дата
Msg-id 20051223125300.B2790F0AC7@svr2.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #2124: Error "relation with OID ... does not exist" when  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      2124
Logged by:
Email address:      andrew_kazachkov@mail.ru
PostgreSQL version: 8.1.1-1
Operating system:   Windows
Description:        Error "relation with OID ... does not exist" when using
temporary table in function.
Details:

After running function proc_3 (described below) more than once error
"relation with OID ... does not exist" occures.

First run of function proc_3() is OK but the second run always fails until
we recreate function proc_2().

Script to reproduce.

--------------------------------------------------------

--DROP FUNCTION proc_1();

CREATE OR REPLACE FUNCTION proc_1() RETURNS int AS
$BODY$
DECLARE
    __nCount int;
BEGIN
    SELECT INTO __nCount COUNT(*) FROM __tmp_xx;
    return __nCount;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;


--DROP FUNCTION proc_2();

CREATE OR REPLACE FUNCTION proc_2() RETURNS int AS
$BODY$
DECLARE
    __nCount int;
BEGIN
    CREATE TEMPORARY TABLE __tmp_xx(
        nId int PRIMARY KEY,
        wstrName varchar(256) NOT NULL
    );
    INSERT INTO __tmp_xx (nId, wstrName) VALUES (1, 'xx');
    __nCount := proc_1();
    DROP TABLE __tmp_xx;
    return __nCount;
END
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;


--DROP FUNCTION proc_3();

CREATE OR REPLACE FUNCTION proc_3() RETURNS int AS
$BODY$
DECLARE
    __nCount int;
BEGIN
    __nCount = proc_2();
    --DELETE FROM t_res;
    --INSERT INTO t_res(nId, nValue) VALUES(1, __nCount);
    return __nCount;
END
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;


SELECT * FROM proc_3();

SELECT * FROM proc_3();

--------------------------------------------------------

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "venkat"
Дата:
Сообщение: BUG #2128: unable to install win32 version of pgsql 8.1.1
Следующее
От: "Tony"
Дата:
Сообщение: BUG #2125: SELECT problem with strings containing \