silly NULL question

From: Dan Weeks <danimal(at)wildbrain(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: silly NULL question
Date: 2003-07-24 23:15:09
Message-ID: 16160.26749.931319.656882@underdog.wildbrain.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Howdy,

I'm sure most of you PostgreSQL users out there will be able to answer
this, but I'm just not finding the answer.

Let's say I have a table called project that has three fields:

field | type
-------------------
id int
name varchar(30)
parent_id int

right now there is only one row in the table:

id | name | parent_id
-----------------------------------
1 | silly |

You'll notice there is nothing in the parent_id as there is no parent for
this particular project. Previously (with PostgreSQL 7.1) a query of:

select * from project where name = 'silly' AND parent_id = NULL;

Would return the row. Now with an upgrade to PostgreSQL 7.3 (yes, I know
there are many changes and we're working through them right now) the same
query returns nothing. Dropping the "AND parent_id = NULL" returns the row
as expected.

Now, what is the correct specifier for an empty int value? Or, are there
suggestions for how to create that column (like using NULL as the default
maybe) that experts can clue-stick me with?

Thanks for your time. If this is the wrong list to ask these questions to
please point me in the right direction.

-dan

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2003-07-24 23:25:16 Re: silly NULL question
Previous Message elein 2003-07-24 19:03:51 Re: obtuse plpgsql function needs