pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: webmaster@duluoz.net
To: pgsql-sql@postgresql.org
Subject: select returning mysterious null rows
Date: Tue, 22 Feb 2000 12:43:32 -0800 (PST)
Message-ID: <20000222204332.22306.qmail@paradise.duluoz.net> (raw)

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@duluoz.net
Duluoz Networks                        http://www.duluoz.net




Message-ID: <20000222204332.22306.qmail@paradise.duluoz.net>
Permalink:  ../20000222204332.22306.qmail@paradise.duluoz.net/
Also on:    postgresql.org/message-id/20000222204332.22306.qmail@paradise.duluoz.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: webmaster@duluoz.net
  Subject: Re: select returning mysterious null rows
  In-Reply-To: <20000222204332.22306.qmail@paradise.duluoz.net>
  References: <20000222204332.22306.qmail@paradise.duluoz.net>

* 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