pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCREATE TYPE function examples
4+ messages / 3 participants
[nested] [flat]
* CREATE TYPE function examples
@ 2001-07-10 15:44 Roberto Mello <rmello@cc.usu.edu>
2001-07-10 16:43 ` Re: CREATE TYPE function examples Peter Eisentraut <peter_e@gmx.net>
2001-07-10 17:30 ` Re: CREATE TYPE function examples Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 4+ messages in thread
From: Roberto Mello @ 2001-07-10 15:44 UTC (permalink / raw)
To: pgsql-sql
I'm looking for some examples of how the functions for CREATE TYPE
should be. There are none in the documentation, so I was hoping to find
someone here that could help me.
For example, the documentation has this example:
CREATE TYPE box (INTERNALLENGTH = 8,
INPUT = my_procedure_1, OUTPUT = my_procedure_2);
What would the functions my_procedure_1 and my_procedure_2 look like?
Thanks,
-Roberto
--
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+
Roberto Mello - Computer Science, USU - http://www.brasileiro.net
http://www.sdl.usu.edu - Space Dynamics Lab, Developer
YES!! eh, NO!!! oh, well MAYBE!!!!!!!!
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: CREATE TYPE function examples
2001-07-10 15:44 CREATE TYPE function examples Roberto Mello <rmello@cc.usu.edu>
@ 2001-07-10 16:43 ` Peter Eisentraut <peter_e@gmx.net>
2001-07-10 17:07 ` Re: CREATE TYPE function examples Roberto Mello <rmello@cc.usu.edu>
1 sibling, 1 reply; 4+ messages in thread
From: Peter Eisentraut @ 2001-07-10 16:43 UTC (permalink / raw)
To: Roberto Mello <rmello@cc.usu.edu>; +Cc: pgsql-sql
Roberto Mello writes:
> I'm looking for some examples of how the functions for CREATE TYPE
> should be. There are none in the documentation, so I was hoping to find
> someone here that could help me.
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/xtypes.html
This seems to be outdated regarding the fmgr update, though. (Hint,
hint...)
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: CREATE TYPE function examples
2001-07-10 15:44 CREATE TYPE function examples Roberto Mello <rmello@cc.usu.edu>
2001-07-10 16:43 ` Re: CREATE TYPE function examples Peter Eisentraut <peter_e@gmx.net>
@ 2001-07-10 17:07 ` Roberto Mello <rmello@cc.usu.edu>
0 siblings, 0 replies; 4+ messages in thread
From: Roberto Mello @ 2001-07-10 17:07 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-sql
On Tue, Jul 10, 2001 at 06:43:59PM +0200, Peter Eisentraut wrote:
>
> http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/xtypes.html
Oh. So you have to write a function in C to use CREATE TYPE?
> This seems to be outdated regarding the fmgr update, though. (Hint,
> hint...)
How so? Would you please elaborate? I'm note familiar with the update.
-Roberto
--
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+
Roberto Mello - Computer Science, USU - http://www.brasileiro.net
http://www.sdl.usu.edu - Space Dynamics Lab, Developer
Politically correct? I'm not even ANATOMICALLY correct!
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: CREATE TYPE function examples
2001-07-10 15:44 CREATE TYPE function examples Roberto Mello <rmello@cc.usu.edu>
@ 2001-07-10 17:30 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 4+ messages in thread
From: Tom Lane @ 2001-07-10 17:30 UTC (permalink / raw)
To: Roberto Mello <rmello@cc.usu.edu>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-07-10 17:30 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-10 15:44 CREATE TYPE function examples Roberto Mello <rmello@cc.usu.edu>
2001-07-10 16:43 ` Peter Eisentraut <peter_e@gmx.net>
2001-07-10 17:07 ` Roberto Mello <rmello@cc.usu.edu>
2001-07-10 17:30 ` Tom Lane <tgl@sss.pgh.pa.us>
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