Re: CREATE TYPE function examples

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Roberto Mello <rmello(at)cc(dot)usu(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: CREATE TYPE function examples
Date: 2001-07-10 17:30:06
Message-ID: 29500.994786206@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Roberto Mello <rmello(at)cc(dot)usu(dot)edu> writes:
> What would the functions my_procedure_1 and my_procedure_2 look like?

src/backend/utils/adt/ is full of examples of datatype I/O procedures.
Pick an existing type that does something vaguely like your type
(at the very least pick one that uses the same kind of representation:
pass-by-value, fixed-length pass-by-reference, or variable-length),
and use its code as a model.

The only thing you need to do differently in dynamically loaded C code
than is done in the main sources is to declare version-1 calling
convention functions with PG_FUNCTION_INFO_V1(). This is assumed for
builtin functions as of 7.1, but the default for dynamically loaded
functions is to assume old-style calling conventions.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dado Feigenblatt 2001-07-10 17:55:28 duplicated OIDs ?
Previous Message Gene the Dancing Machine 2001-07-10 17:13:22 Re: "Display of specified number of records."