what is null

From: John Harrold <jmh17(at)pitt(dot)edu>
To: posgresql hotline <pgsql-general(at)postgresql(dot)org>
Subject: what is null
Date: 2003-08-04 20:54:59
Message-ID: 20030804205459.GI29666@sage.che.pitt.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

i'm trying to alter a table call it 'my_table' and i'm trying to set the
field 'my_id' to prevent null values from being inserted. when i run the
following:

ALTER TABLE my_table ALTER my_id SET NOT NULL;

i get:

ERROR: ALTER TABLE: Attribute "my_id" contains NULL values

so i want to find out which rows have null values so i run:

my=# select my_id from my_table where my_id=NULL;
my_id
---------
(0 rows)

so this would indicate to me that there are no rows in which my_id is NULL.
so what is preventing me from altering the table? or am i just doing
something wrong?

--
--------------------------------------------------------------------------
| /"\
john harrold | \ / ASCII ribbon campaign
jmh at member.fsf.org | X against HTML mail
the most useful idiot | / \
--------------------------------------------------------------------------
What difference does it make to the dead, the orphans, and the homeless,
whether the mad destruction is brought under the name of totalitarianism or
the holy name of liberty and democracy?
--Gandhi
--------------------------------------------------------------------------
gpg --keyserver keys.indymedia.org --recv-key F65A739E
--------------------------------------------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-08-04 20:58:29 Re: varchar, text and cidr
Previous Message scott.marlowe 2003-08-04 20:54:29 Re: what is null