pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dan Weeks <danimal@wildbrain.com>
To: pgsql-sql@postgresql.org
Subject: silly NULL question
Date: Thu, 24 Jul 2003 16:15:09 -0700
Message-ID: <16160.26749.931319.656882@underdog.wildbrain.com> (raw)


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





view thread (3+ messages)  latest in thread

Message-ID: <16160.26749.931319.656882@underdog.wildbrain.com>
Permalink:  ../16160.26749.931319.656882@underdog.wildbrain.com/
Also on:    postgresql.org/message-id/16160.26749.931319.656882@underdog.wildbrain.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: danimal@wildbrain.com
  Subject: Re: silly NULL question
  In-Reply-To: <16160.26749.931319.656882@underdog.wildbrain.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox