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

Re: BUG #2003: Bug with SQL UPDATE on a NUMERIC

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: David Pujol <dpujol(at)toulouse(dot)inra(dot)fr>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2003: Bug with SQL UPDATE on a NUMERIC
Date: 2005-10-27 14:45:34
Message-ID: 20051027074345.X93429@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Thu, 27 Oct 2005, David Pujol wrote:

> 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.

In response to

pgsql-bugs by date

Next:From: IvanDate: 2005-10-27 14:45:54
Subject: Re: pg_dump bud with functions
Previous:From: Tom LaneDate: 2005-10-27 14:34:36
Subject: Re: pg_dump bud with functions

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