pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: mario.splivalo@mobart.hr
Cc: pgsql-sql@postgresql.org
Subject: Re: RETURNS SETOF primitive returns results in parentheses
Date: Wed, 26 Oct 2005 10:40:22 -0400
Message-ID: <5954.1130337622@sss.pgh.pa.us> (raw)
In-Reply-To: <1130330322.7400.45.camel@ekim>
References: <1130330322.7400.45.camel@ekim>

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

			regards, tom lane



view thread (8+ messages)  latest in thread

Message-ID: <5954.1130337622@sss.pgh.pa.us>
Permalink:  ../5954.1130337622@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5954.1130337622@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, mario.splivalo@mobart.hr
  Subject: Re: RETURNS SETOF primitive returns results in parentheses
  In-Reply-To: <5954.1130337622@sss.pgh.pa.us>

* 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