Modulo syntax

From: Oleg Broytmann <phd(at)sun(dot)med(dot)ru>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Modulo syntax
Date: 1999-03-17 08:49:55
Message-ID: Pine.SOL2.3.96.SK.990317114623.27908A-100000@sun.med.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

I ran the query
update producers SET cor_id = producer_id % 9 + 1;

and found that result is eqiuvalent to
update producers SET cor_id = producer_id % 9;

I added parens:
update producers SET cor_id = (producer_id % 9) + 1;

and got what I needed.

Is it a bug, a feature, or I just misinterpreted the syntax?

Oleg.
----
Oleg Broytmann http://members.xoom.com/phd2/ phd2(at)earthling(dot)net
Programmers don't die, they just GOSUB without RETURN.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-03-17 09:00:02 Re: [HACKERS] Re: Developers Globe (FINAL)
Previous Message Jan Wieck 1999-03-17 08:47:36 Re: [HACKERS] Re: Developers Globe (FINAL)