Returning Composite Types from C functions

From: "John Hansen" <john(at)geeknet(dot)com(dot)au>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Returning Composite Types from C functions
Date: 2005-06-18 11:18:34
Message-ID: 5066E5A966339E42AA04BA10BA706AE50A9351@rodrick.geeknet.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-06-18 11:55:40 Re: Returning Composite Types from C functions
Previous Message Andreas Pflug 2005-06-18 08:55:21 Re: default database creation with initdb