Re: PL/SQL question

From: "Froggy / Froggy Corp(dot)" <froggy(at)froggycorp(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/SQL question
Date: 2004-04-21 16:57:20
Message-ID: 4086A7F0.7EB87EC3@froggycorp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

In fact the problem seems to come from the "INSERT INTO". I delete
everything from the function and only keep the "INSERT INTO" and get the
same problem.

Thx in advance for answers,
regards,

Stephan Szabo wrote:
>
> On Tue, 20 Apr 2004, Froggy / Froggy Corp. wrote:
>
> > I try to see if i can make a recursive function with a trigger set on
> > INSERT and doing an insert under my trigger function.
> >
> > So i wrote a test function :
> >
> >
> > CREATE OR REPLACE FUNCTION testfunc() RETURNS SETOF RECORD AS '
> > DECLARE
> > use_t RECORD;
> > BEGIN
> >
> > SELECT INTO use_t id_categorie FROM categorie ORDER BY id_categorie
> > DESC;
> > IF use_t.id_categorie<>50 THEN
> > INSERT INTO categorie (nom) VALUES (''test'');
> > END IF;
> >
> > RETURN NULL;
> >
> > END;
> > 'LANGUAGE plpgsql;
> >
> >
> > The problem is that i can't exec this function to test it, psql return
> > the following error :
> >
> > "ERROR: set-valued function called in context that cannot accept a set"
>
> Record set returning functions aren't called as:
> select foo();
> but instead as
> select * from foo() AS foo(<columns>);
>
> However, since you're not apparently actually returning a set of anything
> in the function you may just want to change the return type.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2004-04-21 17:11:16 Re: [OT] Tom's/Marc's spam filters?
Previous Message miguel angel rojas aquino 2004-04-21 16:02:16 [OT] Problem starting pgsql on windows 2000 server