pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feed From: vz186002@teradata.com
To: pgsql-bugs@postgresql.org
Subject: BUG #11425: Trigger UDF doesn’t properly preserve tuple’s descriptors after "add/drop column" on target table.
Date: Mon, 15 Sep 2014 10:49:50 +0000
Message-ID: <20140915104950.2485.64205@wrigleys.postgresql.org> (raw )
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 11425
Logged by: Van Zhong
Email address: vz186002@teradata.com
PostgreSQL version: 9.3.4
Operating system: Ubento
Description:
Trigger function doesn’t properly preserve tuple’s metadata (rec type) when
"add/drop column" on target table in same session.
We may see incorrect rec type processed or invalid type check failure, but
re-login a session everything goes well.
Such issue could be found in PG9.0 9.1 9.2 9.3 and 8.4
> postgres=# insert into public.t values (1,'test',now());
> NOTICE: (1,test,"2014-09-15 14:15:09.365891")
> NOTICE: (1,test,"2014-09-15 14:15:09.365891")
> INSERT 0 1
> postgres=# insert into public.t values (2,'test',now());
> NOTICE: (2,test,"2014-09-15 14:15:09.386596")
> NOTICE: (2,test,"2014-09-15 14:15:09.386596")
> INSERT 0 1
> postgres=#
> postgres=# alter table public.t add column c3 int;
> ALTER TABLE
> postgres=#
> postgres=# insert into public.t values (3,'test',now(),1);
> NOTICE: (3,test,"2014-09-15 14:15:09.405794",1)
> NOTICE: (3,test,"2014-09-15 14:15:09.405794",)
> INSERT 0 1
> postgres=#
> postgres=# /* you will see new_rec is missing t.c3 for the new inserted
*/
> postgres-# select new_rec from public.undo_t;
> new_rec
> ----------------------------------------
> (1,test,"2014-09-15 14:15:09.365891",)
> (2,test,"2014-09-15 14:15:09.386596",)
> (3,test,"2014-09-15 14:15:09.405794",)
> (3 rows)
>
> postgres=#
> postgres=# \q
> beehive@personal-vm-zhongzhou:~> psql postgres
> psql (8.4.58)
> Type "help" for help.
>
> /* exit session and reinsert a tuple, new_rec.c3 can be seen in new
inserted tuple */
> insert into public.t values (4,'test',now(),1);
>
> postgres=#
> postgres=# /* exit session and reinsert a tuple, new_rec.c3 can be seen in
new inserted tuple */
> postgres-# insert into public.t values (4,'test',now(),1);
> NOTICE: (4,test,"2014-09-15 14:15:09.493459",1)
> NOTICE: (4,test,"2014-09-15 14:15:09.493459",1)
> INSERT 0 1
> postgres=#
> postgres=# select new_rec from public.undo_t;
> new_rec
> -----------------------------------------
> (1,test,"2014-09-15 14:15:09.365891",)
> (2,test,"2014-09-15 14:15:09.386596",)
> (3,test,"2014-09-15 14:15:09.405794",)
> (4,test,"2014-09-15 14:15:09.493459",1)
> (4 rows)
>
> postgres=#
> postgres=# alter table t drop column c2;
> ALTER TABLE
> postgres=#
> postgres=# /* you will see error here */
> postgres-# insert into public.t values (5,now(),1);
> NOTICE: (5,"2014-09-15 14:15:09.555769",1)
> ERROR: invalid input syntax for type timestamp: "1"
> CONTEXT: PL/pgSQL function "undo_t_trace" line 17 at assignment
> postgres=#
> postgres=# \q
> beehive@personal-vm-zhongzhou:~> psql postgres
> psql (8.4.58)
> Type "help" for help.
>
>
> postgres=#
> postgres=# /* without error after relogin a session */
> postgres-# insert into public.t values (5,now(),1);
> NOTICE: (5,"2014-09-15 14:15:09.602766",1)
> NOTICE: (5,"2014-09-15 14:15:09.602766",1)
> INSERT 0 1
> postgres=# select new_rec from public.undo_t;
> new_rec
> ------------------------------------
> (1,"2014-09-15 14:15:09.365891",)
> (2,"2014-09-15 14:15:09.386596",)
> (3,"2014-09-15 14:15:09.405794",)
> (4,"2014-09-15 14:15:09.493459",1)
> (5,"2014-09-15 14:15:09.602766",1)
> (5 rows)
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
view thread (2+ messages) latest in thread
Message-ID: <20140915104950.2485.64205@wrigleys.postgresql.org>
Permalink: ../20140915104950.2485.64205@wrigleys.postgresql.org/
Also on: postgresql.org/message-id/20140915104950.2485.64205@wrigleys.postgresql.org
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: vz186002@teradata.com
Subject: Re: BUG #11425: Trigger UDF doesn’t properly preserve tuple’s descriptors after "add/drop column" on target table.
In-Reply-To: <20140915104950.2485.64205@wrigleys.postgresql.org>
References: <20140915104950.2485.64205@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox