Dave Blasby <dblasby@refractions.net> writes:
> CREATE TABLE test_table (myint integer, mydata MY_DATATYPE);
> INSERT INTO test_table VALUES (1);
> At this point, I'd expect there to be one row in test table. The myint
> column will have the value one, and the mydata column will have the
> value NULL.
Check...
> This doesnt appear to be the case. It seems that the mydata column will
> have a structure that looks like a '-'::TEXT structure (ie. the first 4
> bytes are an int representing 5, and the 5th byte is the ASCII '-').
Uh, what did your CREATE TYPE command look like, exactly? This sounds
like you specified a default value for the datatype.
Maybe you need to show us your datatype's I/O functions, too. Since
this works perfectly fine for the standard variable-length datatypes,
it's hard to arrive at any other conclusion than that your custom
datatype code is erroneous. But there's not enough info here to figure
out just what is wrong with it.
regards, tom lane