Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WgdRy-0002A3-Br for pgsql-bugs@arkaria.postgresql.org; Sat, 03 May 2014 17:10:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WgdRx-0006SU-Mt for pgsql-bugs@arkaria.postgresql.org; Sat, 03 May 2014 17:10:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WgXjm-0004oY-VY for pgsql-bugs@postgresql.org; Sat, 03 May 2014 11:04:11 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WgXjf-00056q-Jl for pgsql-bugs@postgresql.org; Sat, 03 May 2014 11:04:10 +0000 MIME-Version: 1.0 Subject: BUG #10207: Simple select query returns duplicate row - Critical issue To: pgsql-bugs@postgresql.org From: vetri_2020@yahoo.com Date: Sat, 03 May 2014 11:04:01 +0000 Message-ID: <20140503110401.1394.82717@wrigleys.postgresql.org> X-Pg-Spam-Score: 1.7 (+) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 10207 Logged by: Vetri Email address: vetri_2020@yahoo.com PostgreSQL version: 9.2.4 Operating system: Windows 7 Description: I'd encountered an issue in select query when using order by and limit. When I sort by a column which have same values for some data,then the row that appears in first page also appears in next page. For example, select * from table order by col2 limit 10; | col1 | col2 | +----------------------------------------+--------+ | {74414578-F65E-48D1-BB4A-8350A6688989} | test1 | | {B2695B59-FE6D-4CA3-AB6C-CB773FF02A34} | test10 | | {11239516-1A8B-4028-AA54-0E1F091F439E} | test10 | | {CE68934B-72C7-4D5A-99F3-819A5293785F} | test13 | | {BDAFF881-CA4A-4F0F-85AF-36B7C2200A9D} | test13 | | {6C5EC468-25C9-49AC-8FFA-F27DB2DACDF3} | test13 | | {B87C76A9-F450-47FC-8727-8C7F3657F885} | test13 | | {811B5B81-4D75-4B6E-91E7-E791E56A223C} | test2 | | {2A6C9270-ADC5-4059-A0A1-677D27E26AB9} | test3 | | {A2F91E6F-7589-4239-BDF8-C90B11E35487} | test4 | | {B435F056-59FE-46F3-9CE0-7C9019F38885} | test4 | | {4EDAC233-BA9C-4058-80E0-374E02B36D06} | test5 | | {A28B6BC7-BAED-4C7E-90E1-06A253B83D20} | test7 | | {B8201EF9-DCEC-407E-A8E2-775CB246A0BE} | test8 | | {1D0A1EB4-9DCD-4CAE-B66C-13EE853E41D7} | test9 | +----------------------------------------+--------+ returns 10 rows correctly where 5th and 6th row contains same data for col2. Now, when I execute this query , select * from testsort order by col2 limit 5 ; +----------------------------------------+--------+ | col1 | col2 | +----------------------------------------+--------+ | {74414578-F65E-48D1-BB4A-8350A6688989} | test1 | | {B2695B59-FE6D-4CA3-AB6C-CB773FF02A34} | test10 | | {11239516-1A8B-4028-AA54-0E1F091F439E} | test10 | | {6C5EC468-25C9-49AC-8FFA-F27DB2DACDF3} | test13 | | {BDAFF881-CA4A-4F0F-85AF-36B7C2200A9D} | test13 | +----------------------------------------+--------+ And when I execute the below query, the issue occurs. +----------------------------------------+--------+ | col1 | col2 | +----------------------------------------+--------+ | {6C5EC468-25C9-49AC-8FFA-F27DB2DACDF3} | test13 | | {B87C76A9-F450-47FC-8727-8C7F3657F885} | test13 | | {811B5B81-4D75-4B6E-91E7-E791E56A223C} | test2 | | {2A6C9270-ADC5-4059-A0A1-677D27E26AB9} | test3 | | {A2F91E6F-7589-4239-BDF8-C90B11E35487} | test4 | +----------------------------------------+--------+ Look at the results.This row '{6C5EC468-25C9-49AC-8FFA-F27DB2DACDF3}' occurs two times..One in first page and also in next page. This key '{CE68934B-72C7-4D5A-99F3-819A5293785F}' is missing in results. Appreciate your prompt response ! Col datatype - citext -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs