Re: 'within group'- or percentile_cont-expression seems to have ramifications on table ordering

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bernd Hopp <berndjhopp(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: 'within group'- or percentile_cont-expression seems to have ramifications on table ordering
Date: 2021-06-20 17:30:38
Message-ID: 1510943.1624210238@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Bernd Hopp <berndjhopp(at)gmail(dot)com> 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 effects.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bernd Hopp 2021-06-20 17:45:21 Re: 'within group'- or percentile_cont-expression seems to have ramifications on table ordering
Previous Message Tom Lane 2021-06-20 17:26:01 Re: BUG #17065: pg_restore never returns even on simple situations (maybe I just don't understand something)