Re: Returning Composite Types from C functions

From: "John Hansen" <john(at)geeknet(dot)com(dot)au>
To: "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Returning Composite Types from C functions
Date: 2005-06-18 12:03:38
Message-ID: 5066E5A966339E42AA04BA10BA706AE50A9352@rodrick.geeknet.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Fuhr [mailto:mike(at)fuhr(dot)org] Wrote:
> Sent: Saturday, June 18, 2005 9:56 PM
> To: John Hansen
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Returning Composite Types from C functions
>
> On Sat, Jun 18, 2005 at 09:18:34PM +1000, John Hansen wrote:
> >
> > SELECT ('1:2:3:4:5'::text::my_type).*;
> >
> > This results in the text_to_my_type(text) function being called no
> > less than 5 times. Once for each element.
> >
> > Is this the desired behaviour, or a bug?
>
> It's a known behavior with functions that return composite types.
> Apparently it's not easy to fix:
>
> http://archives.postgresql.org/pgsql-hackers/2005-04/msg00971.php

There is a workaround tho, so should be fixable:

SELECT (a.b).* FROM (SELECT ('1:2:3:4:5'::text::my_type) AS b) AS a;

Or am I missing something?

>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
>

... John

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-06-18 13:26:50 Re: LGPL
Previous Message Michael Fuhr 2005-06-18 11:55:40 Re: Returning Composite Types from C functions