Hello, I'm getting this error with the code below (on 8.0.3 like the
other guy in #1702. Is this a hard problem to fix?
Looking at src/pl/plpgsql/src/pl_exec.c for the first time, is it a problem
of make_tuple_from_row() not accounting for nested composite types?
test=# SELECT takes_ct2parts(1, ARRAY['ct2a'], ARRAY['ct1a'], ARRAY['ct1b']);
ERROR: row not compatible with its own tupdesc
CONTEXT: PL/pgSQL function "takes_ct2parts" line 18 at perform
test=# SELECT version(); version
----------------------------------------------------------------------PostgreSQL 8.0.3 on i386-portbld-freebsd4.11,
compiledby GCC 2.95.4
(1 row)
CREATE TYPE ct1 AS (a text,b text
);
CREATE TYPE ct2 AS (a text,b ct1
);
CREATE FUNCTION takes_ct2(ct2)
RETURNS BOOLEAN
RETURNS NULL ON NULL INPUT
VOLATILE
LANGUAGE plpgsql
AS ' BEGIN RETURN TRUE; END;
';
CREATE OR REPLACE FUNCTION takes_ct2parts(int4, text[], text[], text[])
RETURNS BOOLEAN
RETURNS NULL ON NULL INPUT
VOLATILE
LANGUAGE plpgsql
AS ' DECLARE _sz ALIAS FOR $1; _ct2a ALIAS FOR $2; _ct1a ALIAS FOR $3; _ct1b ALIAS FOR $4; _ct1 ct1;
_ct2 ct2; _cnt INTEGER DEFAULT 1; BEGIN WHILE _cnt <= _sz LOOP _ct1.a := _ct1a[_sz]; _ct1.b := _ct1b[_sz];
_ct2.a := _ct2a[_sz]; _ct2.b := _ct1; _cnt := _cnt + 1; END LOOP; PERFORM takes_ct2(_ct2); RETURN
TRUE;END;
';
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991