Skip site navigation (1) Skip section navigation (2)

Bug #709: PL/pgSQL Parameter Of Composite Type

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #709: PL/pgSQL Parameter Of Composite Type
Date: 2002-07-12 00:58:48
Message-ID: 20020712005848.31E18475A34@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
CNLIOU (cnliou(at)eurosport(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
PL/pgSQL Parameter Of Composite Type

Long Description
Hello!

"Example 23-4. A PL/pgSQL Function on Composite Type" says that we are allowed to pass record to pl/pgsql, but actually we are not. Perhaps either the online document or the TODO list should be revised.

Regards,

CN

Sample Code
CREATE TABLE table3(column1 integer);

CREATE FUNCTION test2(table3) RETURNS TEXT AS '
DECLARE
  rec ALIAS FOR $1;
BEGIN
 RETURN rec.column1;
END;' LANGUAGE 'plpgsql';

CREATE FUNCTION test1() RETURNS TEXT AS '
DECLARE
  rec RECORD; --or "rec table3%ROWTYPE;
BEGIN
 SELECT * INTO rec FROM table3 LIMIT 1;
 RETURN test2(rec);
END;' LANGUAGE 'plpgsql';

Gets:
database=# select test1();
NOTICE:  Error occurred while executing PL/pgSQL function test1
NOTICE:  line 5 at return
ERROR:  Attribute 'rec' not found

No file was uploaded with this report


pgsql-bugs by date

Next:From: pgsql-bugsDate: 2002-07-12 01:13:24
Subject: Bug #710: Fail To Create/Drop Temporary Table IN PL/PGSQL
Previous:From: David BusbyDate: 2002-07-11 22:05:56
Subject: postgres.h MACRO issues

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group