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 2C486DAF75 for ; Wed, 26 Oct 2005 16:43:36 -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 62510-04 for ; Wed, 26 Oct 2005 19:43:31 +0000 (GMT) Received: from ls405.htnet.hr (ls405.htnet.hr [195.29.150.97]) by svr1.postgresql.org (Postfix) with ESMTP id E8D12DAE73 for ; Wed, 26 Oct 2005 16:43:31 -0300 (ADT) Received: from ls422.t-com.hr (ls422.t-com.hr [195.29.150.237]) by ls405.htnet.hr (0.0.0/8.12.10) with ESMTP id j9QJhWWj031340; Wed, 26 Oct 2005 21:43:32 +0200 Received: from ls422.t-com.hr (localhost.localdomain [127.0.0.1]) by ls422.t-com.hr (Qmlai) with ESMTP id 2D5CF988043; Wed, 26 Oct 2005 21:43:32 +0200 (CEST) X-Envelope-Sender: mario.splivalo@mobart.hr X-Envelope-Sender: mario.splivalo@mobart.hr Received: from ls422.t-com.hr (localhost.localdomain [127.0.0.1]) by ls422.t-com.hr (Qmlai) with ESMTP id 2921A988042; Wed, 26 Oct 2005 21:43:32 +0200 (CEST) Received: from 83-131-22-222.adsl.net.t-com.hr (83-131-22-222.adsl.net.t-com.hr [83.131.22.222]) by ls422.t-com.hr (Qmlai) with ESMTP id A6A978B8082; Wed, 26 Oct 2005 21:43:31 +0200 (CEST) Subject: Re: RETURNS SETOF primitive returns results in parentheses From: Mario Splivalo Reply-To: mario.splivalo@mobart.hr To: Tom Lane Cc: pgsql-sql@postgresql.org In-Reply-To: <5954.1130337622@sss.pgh.pa.us> References: <1130330322.7400.45.camel@ekim> <5954.1130337622@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8 Organization: Mob-Art Date: Wed, 26 Oct 2005 21:41:39 +0200 Message-Id: <1130355699.18653.0.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200510/344 X-Sequence-Number: 23197 On Wed, 2005-10-26 at 10:40 -0400, Tom Lane wrote: > Mario Splivalo writes: > > biblio3=3D# select * from php_get_subfield_data_repeating(1,'606a'); > > php_get_subfield_data_repeating1 > > ---------------------------------- > > (An=C4=91eli) > > (ofsajd) > > (2 rows) >=20 > > I have return values in parentheses. >=20 > You're getting bit by plpgsql's perhaps-excessive willingness to conver= t > 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=20 > http://www.postgresql.org/docs/8.0/static/rowtypes.html#AEN5604 Wo-ha, makes perfect sense. So, I'd go by with declaring the rec as varchar, instead as of a record. Wich is what I should do in the first place. Thnx for pointing that out. :) Mike