Skip site navigation (1) Skip section navigation (2)

Re: Bad behaviour when inserting unspecified variable length datatypes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Blasby <dblasby(at)refractions(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bad behaviour when inserting unspecified variable length datatypes
Date: 2001-09-03 20:09:43
Message-ID: 6107.999547783@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Dave Blasby <dblasby(at)refractions(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2001-09-03 20:17:54
Subject: Re: OpenFTS (Open Source Full Text Search engine) pre-announce
Previous:From: johan27Date: 2001-09-03 19:02:33
Subject: BIG problem !!:fatal 1:set user id user admin is not in eg shadow

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group