Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl1zr-0006o0-6V for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Nov 2013 19:39:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vl1zq-0002sR-L9 for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Nov 2013 19:39:02 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl1zo-0002pd-Ql for pgsql-bugs@postgresql.org; Mon, 25 Nov 2013 19:39:01 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl1zm-0008B5-5N for pgsql-bugs@postgresql.org; Mon, 25 Nov 2013 19:38:59 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Vl1zl-0004rN-M4 for pgsql-bugs@postgresql.org; Mon, 25 Nov 2013 11:38:57 -0800 Date: Mon, 25 Nov 2013 11:38:57 -0800 (PST) From: David Johnston To: pgsql-bugs@postgresql.org Message-ID: <1385408337668-5780199.post@n5.nabble.com> In-Reply-To: References: Subject: Re: BUG #8629: Strange resultset when using CTE or a subselect MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 1.8 (+) 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 jonathan.camile wrote > The following bug has been logged on the website: > > Bug reference: 8629 > Logged by: Jonathan Camile > Email address: > jonathan.camile@ > PostgreSQL version: 9.2.4 > Operating system: Ubuntu 10.04.4 LTS > Description: > > Hey folks! > > > I have a bit of an issue with a query and I don't understand why. > It might be not very elegant but here it is, when I use the following > query > the last result will always be the same whatsoever the values of LIMIT and > OFFSET. When debugging ORDER BY/LIMIT it is good practice to output the columns being ordered, and others if applicable, and omit the LIMIT (or makes it considerably larger than needed) to see what raw table data the LIMIT clause is seeing. At minimum you need; "SELECT my_table.id, my_table.hdata->'field' FROM ..." for the output and either remove the limit or show at least 30 records initially. The small subset of the data you have provided is insufficient to determine whether you are making bad assumptions about your data or whether there is actually a problem. The fact that it is not self-contained makes debugging difficult as well. Note that LIMIT and OFFSET can appear in either order. While there are some parts of a select statement for which the syntax dictates an order these do not appear to be in the group. If they could not then LIMIT 5 OFFSET 100 would make no sense... -- View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-8629-Strange-resultset-when-using-CTE-or-a-subselect-tp5780187p5780199.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs