pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kumar <sgnerd@yahoo.com.sg>
To: psql <pgsql-sql@postgresql.org>
Subject: Error in declaring %rowtype for recurrence
Date: Tue, 10 Feb 2004 12:11:41 +0530
Message-ID: <006c01c3efa1$2379bde0$7502a8c0@hdsc.com> (raw)

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

view thread (3+ messages)  latest in thread

Message-ID: <006c01c3efa1$2379bde0$7502a8c0@hdsc.com>
Permalink:  ../006c01c3efa1$2379bde0$7502a8c0@hdsc.com/
Also on:    postgresql.org/message-id/006c01c3efa1$2379bde0$7502a8c0@hdsc.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sgnerd@yahoo.com.sg
  Subject: Re: Error in declaring %rowtype for recurrence
  In-Reply-To: <006c01c3efa1$2379bde0$7502a8c0@hdsc.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox