BUG #3916: type of "xxxx" does not match that when preparing the plan

From: "Hubert FONGARNAND" <informatique(dot)internet(at)fiducial(dot)fr>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3916: type of "xxxx" does not match that when preparing the plan
Date: 2008-01-31 13:26:26
Message-ID: 200801311326.m0VDQQBK066130@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3916
Logged by: Hubert FONGARNAND
Email address: informatique(dot)internet(at)fiducial(dot)fr
PostgreSQL version: 8.3RC2
Operating system: Linux Gentoo
Description: type of "xxxx" does not match that when preparing the
plan
Details:

Hi,

We are testing PostGreSQL 8.3 RC2 on our beta plateform and we are facing
some problems with plpgsql function.

Here's a failing test case, which worked well on postgresql 8.1 :

Create this function :

CREATE OR REPLACE FUNCTION test(param integer)
RETURNS text AS
$BODY$DECLARE
attribute TEXT:='';
query TEXT;
curs REFCURSOR;
rec RECORD;
BEGIN
if (param=1) THEN
query := 'SELECT ''test''::varchar AS label';
ELSE
query := 'SELECT ''test''::text AS label';
END IF;
RAISE NOTICE '%',query;
OPEN curs for EXECUTE query;
FETCH curs into rec;
attribute=rec.label;
CLOSE curs;

RETURN attribute;
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE

Execute this function, and this sql :

postgres=# SELECT test(1);
NOTICE: SELECT 'test'::varchar AS label
test
------
test
(1 ligne)

and now :
postgres=# SELECT test(2);
NOTICE: SELECT 'test'::text AS label
ERROR: type of "rec.label" does not match that when preparing the plan
CONTEXT: PL/pgSQL function "test" line 15 at assignment

It seems that if the type of "label" changes from varchar to text it
crashes...

Thanks for fixing this!

Browse pgsql-bugs by date

  From Date Subject
Next Message Olessia 2008-01-31 15:48:05 BUG #3917: Compilation error on VC8.0
Previous Message Stefan Kaltenbrunner 2008-01-31 13:12:46 Re: Supported platforms for PostgreSQL