Re: JOIN query not working as expected - Mailing list pgsql-sql

From Mario Splivalo
Subject Re: JOIN query not working as expected
Date
Msg-id 1133881258.8161.28.camel@ekim
Whole thread Raw
In response to Re: JOIN query not working as expected  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: JOIN query not working as expected
List pgsql-sql
On Tue, 2005-12-06 at 09:58 -0500, Tom Lane wrote:
> Mario Splivalo <mario.splivalo@mobart.hr> writes:
> > Now I want all services which didn't have any messages within certain
> > period:
> > pulitzer2=# select * from services where id not in (select distinct
> > service_id from messages where receiving_time between '2005-10-01' and
> > '2005-10-30');
> > (0 rows)
> 
> > Why is that?
> 
> Probably, you've got some NULLs in the messages.service_id column ...
> try excluding those from the sub-select.

Yes, I've discovered that later. Still, I'm confused with the 'biggies'
at the bottom of my initial mail.

I neglected to metion that I'm using postgresql 7.4.8. I discovered that
I can create a FK on a column wich allows NULL values, and I can even
insert rows with NULLs in FK column, although PK table where FK is
pointing does not allow nuls. Is that 'by design', or...?
Mike
-- 
Mario Splivalo
Mob-Art
mario.splivalo@mobart.hr

"I can do it quick, I can do it cheap, I can do it well. Pick any two."




pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: JOIN query not working as expected
Next
From: Tom Lane
Date:
Subject: Re: JOIN query not working as expected