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 1lv1Hu-0000vg-Ue for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Jun 2021 17:31:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lv1HO-0003vz-HI for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Jun 2021 17:30:42 +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 1lv1HO-0003vr-Ah for pgsql-bugs@lists.postgresql.org; Sun, 20 Jun 2021 17:30:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lv1HM-0000GQ-BJ for pgsql-bugs@lists.postgresql.org; Sun, 20 Jun 2021 17:30:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 15KHUcgO1510944; Sun, 20 Jun 2021 13:30:38 -0400 From: Tom Lane To: Bernd Hopp cc: pgsql-bugs@lists.postgresql.org Subject: Re: 'within group'- or percentile_cont-expression seems to have ramifications on table ordering In-reply-to: References: Comments: In-reply-to Bernd Hopp message dated "Sun, 20 Jun 2021 17:42:09 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1510942.1624210238.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 20 Jun 2021 13:30:38 -0400 Message-ID: <1510943.1624210238@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bernd Hopp writes: > you can see that the rows are not in order of insertion any more, but > in descending order of value. That may not violate the specification, > however I find it > to be counterintuitive that a non-updating query would have such side ef= fects. On what grounds do you say that UPDATE is a non-updating query? UPDATE will always place the new row version somewhere else than the old row version; it cannot simply overwrite the row without violating ACID semantics. In the case you show here, the updated versions are all added at the end of the table, leading to the apparent ordering change. This indeed does not violate the specification, because so far as the SQL spec is concerned, physical row order is simply not of interest. regards, tom lane