[BUG?] UPDATE with RETURNING tableoid

From: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [BUG?] UPDATE with RETURNING tableoid
Date: 2008-12-16 09:36:55
Message-ID: 494776B7.2070804@ak.jp.nec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I found a strange behavior on the recent v8.4devel with/without
SE-PostgreSQL patch set. Can you reproduce the following behavior?

When I use UPDATE statement with RETURNING clause which contains
references to "tableoid" system column, it returns InvalidOid.
(The correct valus is 16384 in this case.)
However, RETURNING clause with INSERT/DELETE statement works well.

----------
postgres=# CREATE TABLE t1 (a int, b text);
CREATE TABLE
postgres=# INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb'), (3, 'ccc');
INSERT 0 3
postgres=# SELECT tableoid, * FROM t1;
tableoid | a | b
----------+---+-----
16384 | 1 | aaa
16384 | 2 | bbb
16384 | 3 | ccc
(3 rows)

postgres=# BEGIN;
BEGIN
postgres=# UPDATE t1 SET b = 'abc' RETURNING tableoid, *;
tableoid | a | b
----------+---+-----
0 | 1 | abc
0 | 2 | abc
0 | 3 | abc
(3 rows)

UPDATE 3
postgres=# ABORT; BEGIN;
ROLLBACK
BEGIN
postgres=# INSERT INTO t1 VALUES (4, 'ddd') RETURNING tableoid, *;
tableoid | a | b
----------+---+-----
16384 | 4 | ddd
(1 row)

INSERT 0 1
postgres=# ABORT; BEGIN;
ROLLBACK
BEGIN
postgres=# DELETE FROM t1 RETURNING tableoid, *;
tableoid | a | b
----------+---+-----
16384 | 1 | aaa
16384 | 2 | bbb
16384 | 3 | ccc
(3 rows)

DELETE 3

--
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shri 2008-12-16 10:05:47 non unique value error... pgsql,,help needed.
Previous Message A. Kretschmer 2008-12-16 08:47:11 Re: How to insert the values of .sql file (dump file) into postgresql 8.1