Re: create type input and output function examples

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: cstotes(at)hotmail(dot)com (Clint Stotesbery)
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: create type input and output function examples
Date: 2003-11-04 11:18:55
Message-ID: 200311041018.LAA19497@rodos
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> I've seen the docs for create type and an example of the syntax to create a
> type. What I haven't seen is the functions that are passed for the input and
> output elements.
>
> CREATE TYPE box (INTERNALLENGTH = 8,
> INPUT = my_procedure_1, OUTPUT = my_procedure_2);
>
> Now what would be in my_procedure1 and my_procedure2 procedures? I know they
> are just example placeholders above but I need to see a real example of what
> would be in those procedures to better understand what they should do.
> Thanks.
>
Pretty late reply, hopefully not too late.
My understanding is these procedures are C functions.
For examples do the following:
List the types already in use and their io-functions as
select typname, typinput, typoutput from pg_type ;
Then search the source code (*.c files)
for <typinput> resp. <typoutput>

There is a box type already.
It's box_in and box_out functions can be found in
$PGSQLD/src/backend/utils/adt/geo_ops.c

HTH
Regards, Christoph

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Paul Ganainm 2003-11-04 15:02:57 Re: Using UNION inside a cursor
Previous Message Jeff Kowalczyk 2003-11-03 16:45:25 Re: Help on update that subselects other records in table, uses joins