pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hitoshi Harada <umi.tanuki@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6139: LIMIT doesn't return correct result when the value is huge
Date: Tue, 2 Aug 2011 06:25:35 GMT
Message-ID: <201108020625.p726PZr2034481@wwwmaster.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      6139
Logged by:          Hitoshi Harada
Email address:      umi.tanuki@gmail.com
PostgreSQL version: 8.2+
Operating system:   Any
Description:        LIMIT doesn't return correct result when the value is
huge
Details: 

db1=# select count(*) from test_xy;
 count 
-------
    31
(1 row)

db1=# select * from test_xy order by x LIMIT 9223372036854775807 OFFSET 6;
 gid |         x          |         y          
-----+--------------------+--------------------
  13 | -0.591943957968476 | -0.481611208406305
(1 row)

db1=# select * from test_xy order by x LIMIT 9223372036854775806 OFFSET 6;
 gid |         x          |         y          
-----+--------------------+--------------------
  13 | -0.591943957968476 | -0.481611208406305
(1 row)

db1=# select * from test_xy order by x LIMIT 9223 OFFSET 6;
 gid |          x          |          y          
-----+---------------------+---------------------
  13 |  -0.591943957968476 |  -0.481611208406305
  12 |  -0.577933450087566 |  -0.513134851138354
  15 |  -0.476357267950963 |  -0.502626970227671
   6 |  -0.227670753064799 |    0.32399299474606
   8 |  -0.220665499124343 |   0.373029772329247
   7 |  -0.199649737302977 |   0.345008756567426
  11 |  -0.182136602451839 |   0.281961471103328
  10 |  -0.115586690017513 |     0.2784588441331
   9 | -0.0980735551663747 |   0.197898423817863
  16 |  0.0980735551663749 |  -0.113835376532399
  19 |   0.353765323992995 |   0.180385288966725
  18 |   0.413309982486865 |   0.152364273204904
  17 |   0.434325744308231 |   0.169877408056042
  21 |   0.458844133099825 |   0.145359019264448
  20 |   0.486865148861646 |  0.0928196147110332
  24 |    1.50963222416813 | -0.0507880910683012
  23 |    1.50963222416813 | -0.0928196147110333
  27 |    1.55516637478109 |   0.544658493870403
  31 |    1.55516637478109 |   0.660245183887916
  28 |    1.59369527145359 |   0.737302977232925
  29 |    1.64273204903678 |   0.618213660245184
db1=# select * from test_xy order by x LIMIT pow(2, 63);
ERROR:  bigint out of range
ERROR:  bigint out of range

Maybe a parser converts literal unexpectedly?



view thread (3+ messages)  latest in thread

Message-ID: <201108020625.p726PZr2034481@wwwmaster.postgresql.org>
Permalink:  ../201108020625.p726PZr2034481@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201108020625.p726PZr2034481@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: umi.tanuki@gmail.com
  Subject: Re: BUG #6139: LIMIT doesn't return correct result when the value is huge
  In-Reply-To: <201108020625.p726PZr2034481@wwwmaster.postgresql.org>
  References: <201108020625.p726PZr2034481@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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