Re: Bad behaviour when inserting unspecified variable length datatypes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bad behaviour when inserting unspecified variable length datatypes
Date
Msg-id 6107.999547783@sss.pgh.pa.us
Whole thread Raw
In response to Bad behaviour when inserting unspecified variable length datatypes  (Dave Blasby <dblasby@refractions.net>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: "Colin 't Hart"
Date:
Subject: Re: Porting to Native WindowsNT/2000
Next
From: Bruce Momjian
Date:
Subject: Re: OpenFTS (Open Source Full Text Search engine) pre-announce