Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6AHUpa09508 for ; Tue, 10 Jul 2001 13:30:51 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f6AHU6J29503; Tue, 10 Jul 2001 13:30:06 -0400 (EDT) To: Roberto Mello cc: pgsql-sql@postgresql.org Subject: Re: CREATE TYPE function examples In-reply-to: <20010710094459.F24104@cc.usu.edu> References: <20010710094459.F24104@cc.usu.edu> Comments: In-reply-to Roberto Mello message dated "Tue, 10 Jul 2001 09:44:59 -0600" Date: Tue, 10 Jul 2001 13:30:06 -0400 Message-ID: <29500.994786206@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200107/109 X-Sequence-Number: 3893 Roberto Mello 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