Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pNB1D-0007L5-6W for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Feb 2023 11:11:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pNB1A-0006cR-BS for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Feb 2023 11:11:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pNB1A-0006WU-0K for pgsql-bugs@lists.postgresql.org; Wed, 01 Feb 2023 11:11:08 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pNB12-0001Vs-JC for pgsql-bugs@lists.postgresql.org; Wed, 01 Feb 2023 11:11:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:To:Sender:From:Date:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=yoXU69xBArbQb82QvQSmBgEfYrJi4ThM1P6YzKsRPDs=; b=idw5A7+kGaJWNyFNp1FFpHUuJ3 MoC3RETKqtLuRBkq1TSqBpgKSzTshJU0IGwCJZt7dMgc8m8lyOsBAFWeTOTXRaC9NagBXiLBCbCmT VUG4P+wKGQKrK51OFQveFqQrOThdp+ltmR5btJB4gR/GNnvTBJwGyLPVpYIFyaeVZQ9Q=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1pNB0z-002HOm-Uj; Wed, 01 Feb 2023 12:10:58 +0100 Date: Wed, 1 Feb 2023 12:10:57 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: prgopikrishnan85@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17766: Issue in asc, limit and offset for pagination. Message-ID: Reply-To: depesz@depesz.com References: <17766-9dd240f7c46fb58b@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <17766-9dd240f7c46fb58b@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Feb 01, 2023 at 06:38:47AM +0000, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 17766 > Logged by: PR Gopi krishnan > Email address: prgopikrishnan85@gmail.com > PostgreSQL version: 15.1 > Operating system: windows and linux > Description: > > While getting the rows with the columns called name which has duplicate > names, now ascending the rows by name with limit 25 and offset 0,25,50 like > this on each query. But the rows are duplicating with the names This is not a bug. Simply make sure that your order by clause is over unique combination. So, if your name has duplicates, then add primary key to order by clause: order by name, id depesz