X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A4CB1DAE3F for ; Wed, 26 Oct 2005 11:40:21 -0300 (ADT) 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 43082-10 for ; Wed, 26 Oct 2005 14:40:17 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9829FDAA57 for ; Wed, 26 Oct 2005 11:40:19 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j9QEeMSL005955; Wed, 26 Oct 2005 10:40:22 -0400 (EDT) To: mario.splivalo@mobart.hr Cc: pgsql-sql@postgresql.org Subject: Re: RETURNS SETOF primitive returns results in parentheses In-reply-to: <1130330322.7400.45.camel@ekim> References: <1130330322.7400.45.camel@ekim> Comments: In-reply-to Mario Splivalo message dated "Wed, 26 Oct 2005 14:38:42 +0200" Date: Wed, 26 Oct 2005 10:40:22 -0400 Message-ID: <5954.1130337622@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/325 X-Sequence-Number: 23178 Mario Splivalo writes: > biblio3=# select * from php_get_subfield_data_repeating(1,'606a'); > php_get_subfield_data_repeating1 > ---------------------------------- > (Anđeli) > (ofsajd) > (2 rows) > I have return values in parentheses. You're getting bit by plpgsql's perhaps-excessive willingness to convert datatypes. Your returnValue variable is not a varchar, it is a record that happens to contain one varchar field. When you do "RETURN NEXT returnValue", plpgsql has to coerce that record value to varchar, and it does that by converting the record value to text ... which produces the parenthesized data format specified at http://www.postgresql.org/docs/8.0/static/rowtypes.html#AEN5604 regards, tom lane