BUG #8046: PL/pgSQL plan caching regression

From: dmitigr(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8046: PL/pgSQL plan caching regression
Date: 2013-04-08 21:33:24
Message-ID: E1UPJgq-0005C1-Ap@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: 8046
Logged by: Dmitriy Igrishin
Email address: dmitigr(at)gmail(dot)com
PostgreSQL version: 9.2.4
Operating system: Linux Debian Wheezy x64
Description:

-- -*- sql -*-
-- A bug test case.
-- PostgreSQL 9.2.4 on x86_64-unknown-linux-gnu, compiled by gcc (Debian
4.7.2-5) 4.7.2, 64-bit

BEGIN;

CREATE OR REPLACE FUNCTION rec(type_name_ regclass, id_ bigint)
RETURNS record
LANGUAGE plpgsql
STABLE
AS $function$
DECLARE
r_ record;
BEGIN
EXECUTE 'SELECT * FROM '||type_name_::text||' WHERE id = $1'
INTO r_ USING id_;

RAISE NOTICE '%', pg_typeof(r_.id);

RETURN r_;
END;
$function$;

CREATE TABLE t1 (id integer);
CREATE TABLE t2 (id bigint);

SELECT rec('t1', 1); -- NOTICE: integer
SELECT rec('t2', 2); -- Should NOTICE: bigint, but RAISE ERROR: type of
parameter 5 (bigint) does not match that when preparing the plan (integer)

ROLLBACK;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-04-08 23:23:17 Re: BUG #8046: PL/pgSQL plan caching regression
Previous Message Jeff Bohmer 2013-04-08 16:06:13 Re: BUG #8043: 9.2.4 doesn't open WAL files from archive, only looks in pg_xlog