Re: Returning Composite Types from C functions - Mailing list pgsql-hackers

From John Hansen
Subject Re: Returning Composite Types from C functions
Date
Msg-id 5066E5A966339E42AA04BA10BA706AE50A9352@rodrick.geeknet.com.au
Whole thread Raw
In response to Returning Composite Types from C functions  ("John Hansen" <john@geeknet.com.au>)
Responses Re: Returning Composite Types from C functions
Re: Returning Composite Types from C functions
List pgsql-hackers
Michael Fuhr [mailto:mike@fuhr.org] Wrote:
> Sent: Saturday, June 18, 2005 9:56 PM
> To: John Hansen
> Cc: pgsql-hackers@postgresql.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



pgsql-hackers by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Returning Composite Types from C functions
Next
From: Jon Jensen
Date:
Subject: Re: Utility database