From: Mario Splivalo <mario.splivalo@mobart.hr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: RETURNS SETOF primitive returns results in parentheses
Date: Wed, 26 Oct 2005 21:41:39 +0200
Message-ID: <1130355699.18653.0.camel@localhost.localdomain> (raw)
In-Reply-To: <5954.1130337622@sss.pgh.pa.us>
References: <1130330322.7400.45.camel@ekim>
<5954.1130337622@sss.pgh.pa.us>
On Wed, 2005-10-26 at 10:40 -0400, Tom Lane wrote:
> Mario Splivalo <mario.splivalo@mobart.hr> 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
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mario.splivalo@mobart.hr, tgl@sss.pgh.pa.us
Subject: Re: RETURNS SETOF primitive returns results in parentheses
In-Reply-To: <1130355699.18653.0.camel@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox