pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14681: Erroneous modulo (%) result
6+ messages / 6 participants
[nested] [flat]

* BUG #14681: Erroneous modulo (%) result
@ 2017-05-31 21:45  marc@daelemans.com
  0 siblings, 5 replies; 6+ messages in thread

From: marc@daelemans.com @ 2017-05-31 21:45 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14681
Logged by:          Marc Daelemans
Email address:      marc@daelemans.com
PostgreSQL version: 9.6.3
Operating system:   Win8.1 x64
Description:        

select i, i&11 as j from generate_series ( 1, 100 ) i ;

generates correct results on Win7 SP1, x64; 16GB machine, and

erroneous results on another PC (Win8.1, x64, GB RAM). 

The Win8.1 PC has Postgresql 9.6.3 and the Win7SP1 PC has Postgresql 9.6.0,
both with PGAdmin3 1.21.1 and identical installation parameters. The only
obvious difference is that the Win8.1 PG installation has Python3.3
installed as an extension (plpython3u), while the Win7 installation does
not. The error remains even after rebooting the Win8.1 PC, and starting PG
without other applications running. I can send a screenshot to show the
problem.
Very strange.
Marc Daelemans +32 475 421 413



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #14681: Erroneous modulo (%) result
@ 2017-05-31 22:34  Thomas Munro <thomas.munro@enterprisedb.com>
  parent: marc@daelemans.com
  4 siblings, 0 replies; 6+ messages in thread

From: Thomas Munro @ 2017-05-31 22:34 UTC (permalink / raw)
  To: marc@daelemans.com; +Cc: pgsql-bugs

On Thu, Jun 1, 2017 at 9:45 AM,  <marc@daelemans.com> wrote:
> select i, i&11 as j from generate_series ( 1, 100 ) i ;

That's bitwise AND, not modulo.

-- 
Thomas Munro
http://www.enterprisedb.com


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #14681: Erroneous modulo (%) result
@ 2017-05-31 22:37  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: marc@daelemans.com
  4 siblings, 0 replies; 6+ messages in thread

From: Alvaro Herrera @ 2017-05-31 22:37 UTC (permalink / raw)
  To: marc@daelemans.com; +Cc: pgsql-bugs

marc@daelemans.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      14681
> Logged by:          Marc Daelemans
> Email address:      marc@daelemans.com
> PostgreSQL version: 9.6.3
> Operating system:   Win8.1 x64
> Description:        
> 
> select i, i&11 as j from generate_series ( 1, 100 ) i ;

Note that you're using the & operator (bitwise and) rather than % here.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #14681: Erroneous modulo (%) result
@ 2017-05-31 22:37  Andres Freund <andres@anarazel.de>
  parent: marc@daelemans.com
  4 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2017-05-31 22:37 UTC (permalink / raw)
  To: marc@daelemans.com; +Cc: pgsql-bugs

On 2017-05-31 21:45:47 +0000, marc@daelemans.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      14681
> Logged by:          Marc Daelemans
> Email address:      marc@daelemans.com
> PostgreSQL version: 9.6.3
> Operating system:   Win8.1 x64
> Description:        
> 
> select i, i&11 as j from generate_series ( 1, 100 ) i ;

Thats not the modulo operator?  You're binary bitwise and-ing i and the
number 11 here.

> generates correct results on Win7 SP1, x64; 16GB machine, and
> erroneous results on another PC (Win8.1, x64, GB RAM). 

Which results are you getting, and what you expecting?


Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #14681: Erroneous modulo (%) result
@ 2017-05-31 22:49  David G. Johnston <david.g.johnston@gmail.com>
  parent: marc@daelemans.com
  4 siblings, 0 replies; 6+ messages in thread

From: David G. Johnston @ 2017-05-31 22:49 UTC (permalink / raw)
  To: marc@daelemans.com; +Cc: pgsql-bugs

On Wed, May 31, 2017 at 2:45 PM, <marc@daelemans.com> wrote:

>
> The Win8.1 PC has Postgresql 9.6.3 and the Win7SP1 PC has Postgresql 9.6.0,
> both with PGAdmin3 1.21.1 and identical installation parameters.


​Might want to run the same under psql to see if pgAdmin or the server is
the source of the discrepancy.

David J.​

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #14681: Erroneous modulo (%) result
@ 2017-06-01 13:45  Tom Lane <tgl@sss.pgh.pa.us>
  parent: marc@daelemans.com
  4 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2017-06-01 13:45 UTC (permalink / raw)
  To: marc@daelemans.com; +Cc: pgsql-bugs

marc@daelemans.com writes:
> select i, i&11 as j from generate_series ( 1, 100 ) i ;
> generates correct results on Win7 SP1, x64; 16GB machine, and
> erroneous results on another PC (Win8.1, x64, GB RAM). 

I'm suspicious that you have some extension that redefines the & operator
and is installed on just one of the two machines.  Running "\do &" in
psql on both systems would be informative.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2017-06-01 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 21:45 BUG #14681: Erroneous modulo (%) result marc@daelemans.com
2017-05-31 22:34 ` Thomas Munro <thomas.munro@enterprisedb.com>
2017-05-31 22:37 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2017-05-31 22:37 ` Andres Freund <andres@anarazel.de>
2017-05-31 22:49 ` David G. Johnston <david.g.johnston@gmail.com>
2017-06-01 13:45 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox