Re: RESULT_OID Bug - Mailing list pgsql-hackers

From Michael Fuhr
Subject Re: RESULT_OID Bug
Date
Msg-id 20050726235815.GA85285@winnie.fuhr.org
Whole thread Raw
In response to RESULT_OID Bug  ("Kevin McArthur" <postgresql-list@stormtide.ca>)
List pgsql-hackers
On Tue, Jul 26, 2005 at 04:31:21PM -0700, Kevin McArthur wrote:
> I cannot repoduce your experience with this bug. No matter what I do, 
> reconnect session or otherwise, it never returns a proper oid on the newer 
> cvs vers (I suspect it may be related to the roles update)

Hmmm...my system is only a couple of hours old; the only code it's
missing is the recent "Minor correction: cause ALTER ROLE role ROLE
role" commit:

http://archives.postgresql.org/pgsql-committers/2005-07/msg00545.php

Here's a test case on my system, run in a fresh session in a
newly-created database named test2:

CREATE TABLE foo (a time DEFAULT now()) WITH OIDS;

CREATE FUNCTION oidtest() RETURNS integer AS $$
DECLARE insert_oid_var INTEGER;
BEGIN INSERT INTO foo DEFAULT VALUES; GET DIAGNOSTICS insert_oid_var = RESULT_OID; RETURN insert_oid_var;
END;
$$ LANGUAGE plpgsql VOLATILE;

SELECT oidtest();oidtest 
---------  16565
(1 row)

SELECT oidtest();oidtest 
---------  16566
(1 row)

CREATE OR REPLACE FUNCTION oidtest() RETURNS integer AS $$
DECLARE insert_oid_var INTEGER;
BEGIN INSERT INTO foo DEFAULT VALUES; GET DIAGNOSTICS insert_oid_var = RESULT_OID; RETURN insert_oid_var;
END;
$$ LANGUAGE plpgsql VOLATILE;

SELECT oidtest();oidtest 
---------       
(1 row)

\c test2
You are now connected to database "test2".

SELECT oidtest();oidtest 
---------  16568
(1 row)

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: ENUM type
Next
From: "Kevin McArthur"
Date:
Subject: Re: RESULT_OID Bug