Skip site navigation (1) Skip section navigation (2)

BUG #3991: pgsql function sum()

From: "mirek" <mirek(at)mascort(dot)com(dot)pl>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3991: pgsql function sum()
Date: 2008-02-26 10:25:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      3991
Logged by:          mirek
Email address:      mirek(at)mascort(dot)com(dot)pl
PostgreSQL version: 8.2.4
Operating system:   Linux fedora(for work) and windows(for development)
Description:        pgsql function sum()

I saw a very strange behavior when i used function SUM() in query (used
inside pg function), query:

select magazyn, ciag, numer, datawp, vat, sum(wnetto-wnettop) as wn,
sum(wvat-wvatp) as wv, sum(wbrutto-wbruttop) as wb from vzk_pozycjezinfo
where magazyn = $1 and ciag = $2 and numer = $3 and datawp = $4
group by magazyn, ciag, numer, datawp, vat 
order by magazyn, ciag, numer, datawp, vat 

vzk_pozycjezinfo is view

problem is in: sum(wvat-wvatp) where field in view wvat = 33.08 and wvatp =
Result is -3.01000000000001 

If I ask postgres manualy: select sum(33.08 - 36.09)
result is ok -3.01 

Now I fix it with round function but i think that is a bug.

With regards


pgsql-bugs by date

Next:From: spol@mail.ruDate: 2008-02-26 11:25:19
Subject: help me plz with 2 postgres users
Previous:From: Magnus HaganderDate: 2008-02-26 09:29:17
Subject: Re: BUG #3985: select command not working

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group