From: | jg(at)pailloncy(dot)com |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #14417: Cache invalidation ? |
Date: | 2016-11-10 16:12:47 |
Message-ID: | 20161110161247.8769.64528@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 14417
Logged by: Jean-Gérard Pailloncy
Email address: jg(at)pailloncy(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-11-10 16:35:42 | Re: Parallel Scan Bug: invalid attnum: 0 |
Previous Message | Tom Lane | 2016-11-10 15:49:35 | Re: Parallel Scan Bug: invalid attnum: 0 |