Re: pg7.3.4: pg_atoi: zero-length string - Mailing list pgsql-general

From Rob Fielding
Subject Re: pg7.3.4: pg_atoi: zero-length string
Date
Msg-id 3FA7C329.5060205@dsvr.net
Whole thread Raw
In response to Re: pg7.3.4: pg_atoi: zero-length string  (Andrew Sullivan <andrew@libertyrms.info>)
List 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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with Pg_dumpall
Next
From: Ron St-Pierre
Date:
Subject: Re: Constraint Problem