select returning mysterious null rows

From: webmaster(at)duluoz(dot)net
To: pgsql-sql(at)postgresql(dot)org
Subject: select returning mysterious null rows
Date: 2000-02-22 20:43:32
Message-ID: 20000222204332.22306.qmail@paradise.duluoz.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi-

I've got the following query:

select d.domain, p.lname, b.period, b.billed_thru,
sum(i.monthly*b.period*discount(b.period)::float) as amount
from billing b, domain d, opt_info i,
opt_list_domains l, plans p
where b.billed_thru <= '$today'
and b.domain = d.domain
and l.domain = d.domain
and i.sname = l.opt
and p.sname = d.base_plan
group by domain, lname, period, billed_thru

It works fine when there are any matching tuples, but when there are
no matches, I get a row returned anyway, with all null fields. The
null tuple isn't returned if any other tuples are -- only by itself.
Can anybody explain what's happening here? I'm using PostgreSQL
6.5.3, and I've seen this behaviour both in psql and through PHP.

-mike

--

Mike Glover webmaster(at)duluoz(dot)net
Duluoz Networks http://www.duluoz.net

Browse pgsql-sql by date

  From Date Subject
Next Message Gordon Clarke 2000-02-22 21:36:20 pg_group system table
Previous Message Thomas Frei 2000-02-22 20:05:59 HOWTO create BLOB fields?