silly NULL question

Поиск
Список
Период
Сортировка
От Dan Weeks
Тема silly NULL question
Дата
Msg-id 16160.26749.931319.656882@underdog.wildbrain.com
обсуждение исходный текст
Ответы Re: silly NULL question  (Rod Taylor <rbt@rbt.ca>)
Список 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




В списке pgsql-sql по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: min() and NaN
Следующее
От: Rod Taylor
Дата:
Сообщение: Re: silly NULL question