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

From John Hansen
Subject Returning Composite Types from C functions
Date
Msg-id 5066E5A966339E42AA04BA10BA706AE50A9351@rodrick.geeknet.com.au
Whole thread Raw
Responses Re: Returning Composite Types from C functions
List pgsql-hackers
Hi all,

CREATE TYPE my_type AS (a int,b int,c int,d int,e int
);

CREATE FUNCTION text_to_my_type(text)
RETURNS my_type
AS 'my_lib.so'
LANGUAGE 'C' IMMUTABLE STRICT;


CREATE CAST (text AS my_type) WITH FUNCTION text_to_my_type (text);

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?



pgsql-hackers by date:

Previous
From: Andreas Pflug
Date:
Subject: Re: Utility database (Was: RE: Autovacuum in the backend)
Next
From: Michael Fuhr
Date:
Subject: Re: Returning Composite Types from C functions