Re: pg7.3.4: pg_atoi: zero-length string

rob <rob@dsvr.net>

From: Rob Fielding <rob@dsvr.net>
To: pgsql-general@postgresql.org
Date: 2003-11-04T15:18:01Z
Lists: pgsql-general
> For the record, it _never_ treated it as NULL.  It treated it as
> "empty string".  '' != NULL.  In fact, !(NULL=NULL) & !(NULL!=NULL). 
> SQL uses three-valued logic.


You're absolutely right.  That explains why, when I quickly looked, some 
are zero's and some are NULLs - the NULLs where NULLs and the zeros 
where empty strings.

Two different bad-programming examples.  If I actually used these 
columns for anything whenever they didn't have non zero or null data in 
them then I'd have probably been alot more careful about what went in them.

I presume that an 32bit integer of zero and a NULL are represented 
differently in the database ?  I suppose internally you aren't 
representing a NULL within the context of a 32bit integer field and it 
would just probably be magic pointer to the next field - some sort of 
exercise in space squashing?  I don't know anything about the internal 
stucture of the tuples.

Dependant on the above, it would probably make sense to clean up the 
database, especially considering these columns are also indexed.


Cheers

-- 

Rob Fielding
Development
Designer Servers Ltd