Re: Custom Base Type in C

From: "David Wilson" <david(dot)t(dot)wilson(at)gmail(dot)com>
To: "Toby Chavez" <odnamr(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Custom Base Type in C
Date: 2008-05-07 23:12:56
Message-ID: e7f9235d0805071612j5ae043co56fb99287f24ced9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 7, 2008 at 7:06 PM, Toby Chavez <odnamr(at)gmail(dot)com> wrote:

> My custom type needs to have one biginteger and one text value... pretty
> straight forward. I guess my first question is if there are any examples out
> there that do something similar. I have looked extensively through the
> contrib directory and can't find anything very helpful. If not, could
> someone help me understand what my c struct would look like and what values
> I need for INTERNALLENGTH, ALIGNMENT, STORAGE, etc in the CREATE TYPE
> command?

Is there any particular reason why this needs to be done in C? Why not
just create the type normally as per:

CREATE TYPE my_transition_type AS (a bigint, b text);

And then create your aggregate function using that type?

I can't help you with the C stuff, but you may be making far more work
for yourself than you really need.

--
- David T. Wilson
david(dot)t(dot)wilson(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-05-07 23:15:10 Re: Custom Base Type in C
Previous Message Toby Chavez 2008-05-07 23:06:40 Custom Base Type in C