Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XTbMH-0002Zj-4B for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Sep 2014 18:50:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XTbMG-0002H1-4a for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Sep 2014 18:50:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XTTrI-0005zm-4y for pgsql-bugs@postgresql.org; Mon, 15 Sep 2014 10:50:12 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XTTr9-0007HN-RC for pgsql-bugs@postgresql.org; Mon, 15 Sep 2014 10:50:11 +0000 MIME-Version: 1.0 Subject: =?utf-8?q?BUG_=2311425=3A_Trigger_UDF_doesn=E2=80=99t_properly_pre?= =?utf-8?q?serve_tuple=E2=80=99s_descriptors_after_=22add/drop_column=22_on_?= =?utf-8?q?target_table=2E?= To: pgsql-bugs@postgresql.org From: vz186002@teradata.com Date: Mon, 15 Sep 2014 10:49:50 +0000 Message-ID: <20140915104950.2485.64205@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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