Re: pl/pgsql problem with return types

From: Juris Zeltins <juris(dot)zeltins(at)gmail(dot)com>
To: John DeSoi <desoi(at)pgedit(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pl/pgsql problem with return types
Date: 2005-03-11 12:50:13
Message-ID: 42319405.5050603@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Yep.. i have solved this problem by specifying
the correct return type and variable type (should be the same)

but as said, in some cases pl_exec executes with type conversion.
as real example - i have :

return type = SETOF new type "category_node(catid, pcatid)"
variable = R, SR -> RECORD

and

FOR R IN select * from ...
LOOP
RETURN NEXT R; /* add RECORD to SETOF_of_CATEGORY_NODE */
....

and works...
the problem seems is teh same - on altered tables there is some porblem
with this :)

Actualy - return type & variable in "RETURN NEXT" must be the same type.

// Solved

John DeSoi wrote:

>
> On Mar 11, 2005, at 5:54 AM, Juris Zeltins wrote:
>
>> FOR P IN select pageid from pages
>>
>
> This way you are only getting the pageid column. I think what you want is
>
> FOR P in select * from pages
>
> so that P contains the complete pages record.
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-03-11 13:05:28 Re: [GENERAL] more execution time
Previous Message John DeSoi 2005-03-11 12:46:42 Re: pl/pgsql problem with return types