BUG #5377: group by problem

From: "michel rosa" <mrosa(at)geomatic(dot)ch>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5377: group by problem
Date: 2010-03-18 10:37:47
Message-ID: 201003181037.o2IAbluQ029864@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5377
Logged by: michel rosa
Email address: mrosa(at)geomatic(dot)ch
PostgreSQL version: 8.3.10
Operating system: debian
Description: group by problem
Details:

Hello,

I have the following problem

select to_char(upload_date, 'yyyy-mm-dd'),cost,count(cost) from
evadeo.tileshop
where status=2
and source=3
and upload_date>='2010-03-01'
and upload_date<='2010-03-02'
group by to_char(upload_date, 'yyyy-mm-dd'),cost
order by to_char(upload_date, 'yyyy-mm-dd'),cost

give as result

to_char | cost | count
------------+------+-------
2010-03-01 | 0 | 345
2010-03-01 | 0.5 | 38
2010-03-01 | 1 | 9
2010-03-01 | 1.5 | 164
2010-03-02 | 0 | 837
2010-03-02 | 0.5 | 136
2010-03-02 | 1.5 | 138

but when upload_date<='2010-03-03', I get extras rows for 2010-03-02

select to_char(upload_date, 'yyyy-mm-dd'),cost,count(cost) from
evadeo.tileshop
where status=2
and source=3
and upload_date>='2010-03-01'
and upload_date<='2010-03-03'
group by to_char(upload_date, 'yyyy-mm-dd'),cost
order by to_char(upload_date, 'yyyy-mm-dd'),cost

to_char | cost | count
------------+------+-------
2010-03-01 | 0 | 345
2010-03-01 | 0.5 | 38
2010-03-01 | 1 | 9
2010-03-01 | 1.5 | 164
2010-03-02 | 0 | 1217
2010-03-02 | 0.5 | 287
2010-03-02 | 1 | 11894
2010-03-02 | 1.5 | 379
2010-03-02 | 2.0 | 7
2010-03-02 | 3.0 | 3
2010-03-03 | 0 | 7393
2010-03-03 | 0.5 | 85
2010-03-03 | 1.5 | 152

do you have an explication ?
Is it really a bug ?

thanks

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavel Stehule 2010-03-18 10:37:53 Re: text cast to bool bug
Previous Message Laczi József 2010-03-18 10:08:24 text cast to bool bug