Re: behavior of GROUP BY with VOLATILE expressions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Paul George <p(dot)a(dot)george19(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Richard Guo <guofenglinux(at)gmail(dot)com>
Subject: Re: behavior of GROUP BY with VOLATILE expressions
Date: 2024-07-19 21:27:52
Message-ID: CAKFQuwZ=Rwp_1kay=RF1txrMM+87Rz5o34aS5n7dPf=u9UW0Mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 19, 2024 at 2:21 PM Paul George <p(dot)a(dot)george19(at)gmail(dot)com> wrote:

> Great, thanks for the links and useful past discussions! I figured I
> wasn't the first to stumble across this, and it's interesting to see the
> issue arise with ORDER BY [VOLATILE FUNC] as well.
>
> My question was not so much about changing behavior as it was about
> understanding what is desired, especially in light of the fact that
> subqueries behave differently. From my reading of the links you provided,
> it seems that even the notion of "desired" here is itself dubious and that
> there is a case for reevaluating RANDOM() everywhere and a case for not
> doing that. Given this murkiness, is it fair then to say that drawing
> parallels between how GROUP BY subquery is handled is moot?
>

Only now just grasping that you are trying to group something that is
definitionally random. That just doesn't make sense to me. Grouping is
for categorical data (loosely defined, something like Invoice# arguably
counts as a category if you are looking at invoice details.)

I'll stick with: this whole area, implementation-wise, is going to remain
status-quo. If you've got ideas for documenting it better hopefully a
patch goes in at some point. Mostly that can be done black-box style -
inputs and outputs, not code reading.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Tachoires 2024-07-19 22:05:07 Re: Compress ReorderBuffer spill files using LZ4
Previous Message Jeff Davis 2024-07-19 21:21:58 Re: Statistics Import and Export