Pietro Bernardi - 2008-03-09

Logged In: YES
user_id=2014513
Originator: NO

IMHO you are right, it's worse, this bug affects not only '+='. See this:

>>> ZERO = PgSQL.PgNumeric('0')
>>> a = ZERO; b = ZERO; b = b + 1; c = ZERO
>>> print ZERO,a,b,c
0 0 1 0
>>> a = ZERO; b = ZERO; b += 1; c = ZERO
>>> print ZERO,a,b,c
1 1 1 1
>>> ZERO = PgSQL.PgNumeric('0')
>>> a = ZERO; b = ZERO; b = b - 1; c = ZERO
>>> print ZERO,a,b,c
0 0 -1 0
>>> a = ZERO; b = ZERO; b -= 1; c = ZERO
>>> print ZERO,a,b,c
-1 -1 -1 -1
>>> TWO = PgSQL.PgNumeric('2')
>>> a = TWO; b = TWO; b = b * 3; c = TWO
>>> print TWO,a,b,c
2 2 6 2
>>> a = TWO; b = TWO; b *= 3; c = TWO
>>> print TWO,a,b,c
6 6 6 6
>>> TWO = PgSQL.PgNumeric('2')
>>> a = TWO; b = TWO; b = b / 2; c = TWO
>>> print TWO,a,b,c
2 2 1 2
>>> a = TWO; b = TWO; b /= 2; c = TWO
>>> print TWO,a,b,c
1 1 1 1

Regards,
Pietro