Re: RETURNS SETOF primitive returns results in parentheses - Mailing list pgsql-sql

From Tom Lane
Subject Re: RETURNS SETOF primitive returns results in parentheses
Date
Msg-id 5954.1130337622@sss.pgh.pa.us
Whole thread Raw
In response to RETURNS SETOF primitive returns results in parentheses  (Mario Splivalo <mario.splivalo@mobart.hr>)
Responses Re: RETURNS SETOF primitive returns results in parentheses  (Mario Splivalo <mario.splivalo@mobart.hr>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Jan Wieck
Date:
Subject: Re: pl/* overhead ...
Next
From: Scott Marlowe
Date:
Subject: Re: why vacuum