BUG #1702: Function returning nested composite types

From: "Jan Behrens" <jan(at)monso(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1702: Function returning nested composite types
Date: 2005-06-05 15:18:11
Message-ID: 20050605151811.71838F0B06@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1702
Logged by: Jan Behrens
Email address: jan(at)monso(dot)de
PostgreSQL version: 8.0.3
Operating system: NetBSD
Description: Function returning nested composite types
Details:

Following input:

CREATE TYPE test1 AS (a text, b text);
CREATE TYPE test2 AS (c test1, d test1);

CREATE FUNCTION test3 () RETURNS test2
LANGUAGE 'plpgsql' AS $$
DECLARE
result test2;
BEGIN
result := ROW (ROW ('1', '2'), ROW ('3', '4'));
RETURN result;
END; $$;

SELECT * FROM test3();

generates the following error:

ERROR: row not compatible with its own tupdesc
CONTEXT: PL/pgSQL function "test3" line 5 at return

I assume this is a bug, because the source code says:

if (estate->retval == (Datum) NULL)
/* should not happen */
elog(ERROR,
"row not compatible with its own tupdesc");
[...]
if (tup == NULL) /* should not happen */
elog(ERROR,
"row not compatible with its own tupdesc");

Browse pgsql-bugs by date

  From Date Subject
Next Message Tavis Rudd 2005-06-06 06:50:51 BUG #1703: dns for ftp mirrors messed up
Previous Message Dan 2005-06-05 06:54:11 BUG #1701: Installer problem w/ encryption