dbTalk Databases Forums  

[BUGS] BUG #2003: Bug with SQL UPDATE on a NUMERIC

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2003: Bug with SQL UPDATE on a NUMERIC in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Pujol
 
Posts: n/a

Default [BUGS] BUG #2003: Bug with SQL UPDATE on a NUMERIC - 10-27-2005 , 09:22 AM







The following bug has been logged online:

Bug reference: 2003
Logged by: David Pujol
Email address: dpujol (AT) toulouse (DOT) inra.fr
PostgreSQL version: 8.0 and 7.4
Operating system: Windows and linux
Description: Bug with SQL UPDATE on a NUMERIC
Details:

Hello, I've noticed a bug when I modify a quantity with an INSERT and a
minus operator.
My request is:
UPDATE products SET pr_stock=pr_stock--1 WHERE pr_code=600;

I haven't SQL error but 'pr_stock' value (numeric(5,1)) is unchanged : no
increment or decrement.

I've made tests:
- 'pr_stock=pr_stock +- 1' is OK (substraction -1)
- 'pr_stock=pr_stock ++ 1' is OK ( +1)
- 'pr_stock=pr_stock -+ 1' is OK ( -1)
- 'pr_stock=pr_stock -- 1' is not OK (no change, no error)

Same things with brackets :
- 'pr_stock=pr_stock +(- 1)' is OK (substraction -1)
- 'pr_stock=pr_stock +(+ 1)' is OK ( +1)
- 'pr_stock=pr_stock -(+ 1)' is OK ( -1)
- 'pr_stock=pr_stock -(- 1)' is not OK (no change, no error)

This bug report is for Windows XP + Postresql 8.0 and for Linux + Postgresql
7.4


PS : Sorry for my english ; I'm french!

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply With Quote
  #2  
Old   
Stephan Szabo
 
Posts: n/a

Default Re: [BUGS] BUG #2003: Bug with SQL UPDATE on a NUMERIC - 10-27-2005 , 09:48 AM






On Thu, 27 Oct 2005, David Pujol wrote:

Quote:
Hello, I've noticed a bug when I modify a quantity with an INSERT and a
minus operator.
My request is:
UPDATE products SET pr_stock=pr_stock--1 WHERE pr_code=600;

I haven't SQL error but 'pr_stock' value (numeric(5,1)) is unchanged : no
increment or decrement.

I've made tests:
- 'pr_stock=pr_stock +- 1' is OK (substraction -1)
- 'pr_stock=pr_stock ++ 1' is OK ( +1)
- 'pr_stock=pr_stock -+ 1' is OK ( -1)
- 'pr_stock=pr_stock -- 1' is not OK (no change, no error)

Same things with brackets :
- 'pr_stock=pr_stock +(- 1)' is OK (substraction -1)
- 'pr_stock=pr_stock +(+ 1)' is OK ( +1)
- 'pr_stock=pr_stock -(+ 1)' is OK ( -1)
- 'pr_stock=pr_stock -(- 1)' is not OK (no change, no error)
I cannot reproduce the second case here on 8.0.x + Linux. I get an
addition of 1. The first case is user error I think because I believe --
is the comment beginning marker.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.