pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
date_part, too many results?
2+ messages / 2 participants
[nested] [flat]

* date_part, too many results?
@ 2000-02-24 22:38 M.Mazurek@poznan.multinet.pl
  2000-02-25 00:46 ` Re: [SQL] date_part, too many results? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: M.Mazurek@poznan.multinet.pl @ 2000-02-24 22:38 UTC (permalink / raw)
  To: pgsql-sql

Hi,
clicked table is empty for bannerid=1, so why is that row? How to get rid
of it?
tia
mazek

bannerdb=> select count(*),date_part('dow',data::datetime) from clicked
where bannerid=1 group by date_part('dow',data::datetime);
count|date_part
-----+---------
    0|         
(1 row)


Marcin Mazurek

-- 
administrator
MULTINET SA o/Poznan
http://www.multinet.pl/




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] date_part, too many results?
  2000-02-24 22:38 date_part, too many results? M.Mazurek@poznan.multinet.pl
@ 2000-02-25 00:46 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2000-02-25 00:46 UTC (permalink / raw)
  To: M.Mazurek@poznan.multinet.pl; +Cc: pgsql-sql

M.Mazurek@poznan.multinet.pl writes:
> clicked table is empty for bannerid=1, so why is that row? How to get rid

> bannerdb=> select count(*),date_part('dow',data::datetime) from clicked
> where bannerid=1 group by date_part('dow',data::datetime);
> count|date_part
> -----+---------
>     0|         
> (1 row)

It's not date_part's fault, it's count's fault.  There should be no rows
out if you have GROUP BY and no groups, but 6.5 and prior Postgres
releases emit a dummy row anyway.  This is a longstanding bug in
Postgres's handling of aggregate functions.  It's fixed for 7.0, if you
want to try running the beta version... if not, you could add
HAVING count(*) > 0 as a temporary workaround.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-02-25 00:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-02-24 22:38 date_part, too many results? M.Mazurek@poznan.multinet.pl
2000-02-25 00:46 ` Tom Lane <tgl@sss.pgh.pa.us>

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