July 2005
Intermediate to advanced
1032 pages
27h 10m
English
At this point, PostgreSQL knows about your input and output functions. Now you can tell PostgreSQL about your data type:
CREATE TYPE FCUR ( INPUT=fcur_in, OUTPUT=fcur_out, INTERNALLENGTH=12 );
This command creates a new data type (how exciting) named FCUR. The input function is named fcur_in, and the output function is named fcur_out. The INTERNALLENGTH=12 clause tells PostgreSQL how much space is required to hold the internal value. I computed this value by hand—just add up the size of each member of the fcur structure and be sure that you account for any pad bytes. The safest way to compute the INTERNALLENGTH is to use your C compiler's sizeof() operator.
Let's create a table that uses this data type and ...
Read now
Unlock full access