pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Roberto Mello <rmello@cc.usu.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: CREATE TYPE function examples
Date: Tue, 10 Jul 2001 13:30:06 -0400
Message-ID: <29500.994786206@sss.pgh.pa.us> (raw)
In-Reply-To: <20010710094459.F24104@cc.usu.edu>
References: <20010710094459.F24104@cc.usu.edu>

Roberto Mello <rmello@cc.usu.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



view thread (4+ messages)

Message-ID: <29500.994786206@sss.pgh.pa.us>
Permalink:  ../29500.994786206@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29500.994786206@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rmello@cc.usu.edu
  Subject: Re: CREATE TYPE function examples
  In-Reply-To: <29500.994786206@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox