From: | Anh Pham <atpham(dot)wpi(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org, PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | [NOVICE]Convert Datum to an user-defined data type? |
Date: | 2014-03-10 14:09:57 |
Message-ID: | CAL7AQBZ_D2uOhcP5fcfOvtnF7eBFBUVWKjSNNxDA+PssyR4+EQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
Hi everyone,
I have created a new data types using SQL in a database:
CREATE TYPE *type1* AS (
score integer,
time integer[],
);
I also created a server extension module (C code), and I was able to
retrieve a Datum value of *type1 *from the database (using SPI_ functions)
My question is: how can I convert that Datum value back to type1 data
structure (in C code), so I can easily deal with score and time values?
typedef struct *type1*{
int score;
int *time;
} type1;
PS: I really don't want to deal with cstring to in order to get the score
and time attributes.
Many thanks :)
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2014-03-10 15:02:35 | Re: [GENERAL] Convert Datum to an user-defined data type? |
Previous Message | Marko Kreen | 2014-03-10 13:53:06 | Re: libpq - lack of support to set the fetch size |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2014-03-10 15:02:35 | Re: [GENERAL] Convert Datum to an user-defined data type? |
Previous Message | Thom Brown | 2014-03-09 02:14:15 | Re: Trigger function |