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

From: Rob Fielding <rob(at)dsvr(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pg7.3.4: pg_atoi: zero-length string
Date: 2003-11-04 15:18:01
Message-ID: 3FA7C329.5060205@dsvr.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron St-Pierre 2003-11-04 16:39:13 Re: Constraint Problem
Previous Message Tom Lane 2003-11-04 15:16:26 Re: Problem with Pg_dumpall