pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jg@pailloncy.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14417: Cache invalidation ?
Date: Thu, 10 Nov 2016 16:12:47 +0000
Message-ID: <20161110161247.8769.64528@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:      14417
Logged by:          Jean-Gérard Pailloncy
Email address:      jg@pailloncy.com
PostgreSQL version: 9.6.0
Operating system:   Mac OS X 10.12.1
Description:        

PostgreSQL 9.6.0 on x86_64-apple-darwin14.5.0, compiled by Apple LLVM
version 7.0.0 (clang-700.1.76), 64-bit

Darwin RilkAir.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13
21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64

When I run the following script I got an error on the last INSERT. If I quit
psql and reconnect no more error. I suspect a cache invalidation bug after
the ALTER TABLE.

CREATE OR REPLACE FUNCTION d(_x anyelement)
 RETURNS anyelement
 LANGUAGE plpgsql
AS $$
BEGIN
 RAISE WARNING '%', _x;
 RETURN _x;
END
$$;

CREATE TABLE t(
  i int
);

CREATE OR REPLACE FUNCTION g()
 RETURNS trigger
 LANGUAGE plpgsql
 SET search_path TO debug
AS $$
DECLARE
 _i int;
BEGIN
 PERFORM d( NEW );
 RETURN NEW;
END
$$;

CREATE TRIGGER td BEFORE INSERT OR UPDATE ON t FOR ROW EXECUTE PROCEDURE
g();

INSERT INTO t VALUES (1);

ALTER TABLE t ADD COLUMN a int[];
COMMIT;

INSERT INTO t VALUES (2, ARRAY[3,4]);
COMMIT;

The error is:
ERROR:  42804: returned record type does not match expected record type
DETAIL:  Number of returned columns (1) does not match expected column count
(2).
CONTEXT:  PL/pgSQL function d(anyelement) while casting return value to
function's return type
SQL statement "SELECT d( NEW )"
PL/pgSQL function g() line 5 at PERFORM
LOCATION:  convert_tuples_by_position, tupconvert.c:138



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Message-ID: <20161110161247.8769.64528@wrigleys.postgresql.org>
Permalink:  ../20161110161247.8769.64528@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20161110161247.8769.64528@wrigleys.postgresql.org

 · 

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: jg@pailloncy.com
  Subject: Re: BUG #14417: Cache invalidation ?
  In-Reply-To: <20161110161247.8769.64528@wrigleys.postgresql.org>
  References: <20161110161247.8769.64528@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