| From: | Mario Splivalo <mario(dot)splivalo(at)mobart(dot)hr> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: RETURNS SETOF primitive returns results in parentheses |
| Date: | 2005-10-26 19:41:39 |
| Message-ID: | 1130355699.18653.0.camel@localhost.localdomain |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Wed, 2005-10-26 at 10:40 -0400, Tom Lane wrote:
> 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
> > ----------------------------------
> > (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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-10-26 19:45:33 | Re: RETURNS SETOF primitive returns results in parentheses |
| Previous Message | Bruno Wolff III | 2005-10-26 18:40:02 | Re: select best price |