It took me a while to figure out what was going on, but I think I've
figured it out.
Lets say you have your own variable length datatype called
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
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 '-').
This is really bad because a "SELECT * FROM test_table" will send this
weird structure to MY_DATATYPE's OUTPUT function. Since this weird
structure isn't really a MY_DATATYPE structure, it causes problems.
This happens even if you explictly set MY_DATATYPE's DEFAULT to NULL.
pgsql-hackers by date
|Next:||From: Martin Weinberg||Date: 2001-08-31 20:04:31|
|Subject: Why "ERROR: dtoi4: integer out of range" on pg_dump|
|Previous:||From: Barry Lind||Date: 2001-08-31 17:03:04|
|Subject: Re: Escaping strings for inclusion into SQL queries|