X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9F0F95645E for ; Fri, 11 Mar 2005 12:55:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18592-03 for ; Fri, 11 Mar 2005 12:55:21 +0000 (GMT) Received: from mail.diglat.lv (unknown [159.148.213.135]) by svr1.postgresql.org (Postfix) with ESMTP id 0A17A5514D for ; Fri, 11 Mar 2005 12:55:19 +0000 (GMT) Received: from localhost ([127.0.0.1]) by mail.diglat.lv (Kerio MailServer 6.0.8); Fri, 11 Mar 2005 14:55:17 +0200 Message-ID: <42319405.5050603@gmail.com> Date: Fri, 11 Mar 2005 14:50:13 +0200 From: Juris Zeltins User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John DeSoi Cc: pgsql-sql@postgresql.org Subject: Re: pl/pgsql problem with return types References: <423178FC.3050107@gmail.com> <9ECE66EE-922B-11D9-B332-000A95B03262@pgedit.com> In-Reply-To: <9ECE66EE-922B-11D9-B332-000A95B03262@pgedit.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.381 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200503/162 X-Sequence-Number: 20641 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 > >