Error in declaring %rowtype for recurrence

From: "Kumar" <sgnerd(at)yahoo(dot)com(dot)sg>
To: "psql" <pgsql-sql(at)postgresql(dot)org>
Subject: Error in declaring %rowtype for recurrence
Date: 2004-02-10 06:41:41
Message-ID: 006c01c3efa1$2379bde0$7502a8c0@hdsc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear Friends,

Postgres 7.3.4 on RH Linux 7.2

I am having an table name recurrence under the schema crm. While I refer it as %rowtype I have error msgs.

CREATE OR REPLACE FUNCTION crm.fn_rowtypetest() RETURNS varchar AS
'DECLARE
rec_recurrence crm.recurrences%rowtype;
BEGIN
FOR rec_recurrence IN SELECT * FROM crm.recurrences LOOP
RAISE NOTICE 'Hai';
END LOOP;
RETURN 'DONE';
END;'
LANGUAGE 'plpgsql' VOLATILE;

while I execute
select crm.fn_rowtypetest()

WARNING: plpgsql: ERROR during compile of fn_rowtypetest near line 0

ERROR: cache lookup for type 0 of recurrences.........pg.dropped.16........ failed

The same function works if I declare that via an record type

CREATE OR REPLACE FUNCTION crm.fn_rowtypetest() RETURNS varchar AS
'DECLARE
rec_recurrence record; ------------------------------------------------------------------------------------------ Note the change here
BEGIN
FOR rec_recurrence IN SELECT * FROM crm.recurrences LOOP
RAISE NOTICE 'Hai';
END LOOP;
RETURN 'DONE';
END;'
LANGUAGE 'plpgsql' VOLATILE;

Why is that so? Anyone can please clear me.

Regards
Kumar

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-02-10 08:29:09 Re: Bug or Feature?
Previous Message Robert Creager 2004-02-10 03:25:33 Re: Implementation of a bag pattern using rules