Re: RETURNS SETOF primitive returns results in parentheses

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mario(dot)splivalo(at)mobart(dot)hr
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: RETURNS SETOF primitive returns results in parentheses
Date: 2005-10-26 14:40:22
Message-ID: 5954.1130337622@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Mario Splivalo <mario(dot)splivalo(at)mobart(dot)hr> writes:
> biblio3=# select * from php_get_subfield_data_repeating(1,'606a');
> php_get_subfield_data_repeating1
> ----------------------------------
> (Aneli)
> (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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2005-10-26 14:44:51 Re: why vacuum
Previous Message Jan Wieck 2005-10-26 14:28:30 Re: pl/* overhead ...