Re: behavior of GROUP BY with VOLATILE expressions - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: behavior of GROUP BY with VOLATILE expressions
Date
Msg-id CAKFQuwZ=Rwp_1kay=RF1txrMM+87Rz5o34aS5n7dPf=u9UW0Mg@mail.gmail.com
Whole thread Raw
In response to Re: behavior of GROUP BY with VOLATILE expressions  (Paul George <p.a.george19@gmail.com>)
Responses Re: behavior of GROUP BY with VOLATILE expressions
List pgsql-hackers
On Fri, Jul 19, 2024 at 2:21 PM Paul George <p.a.george19@gmail.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.

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Statistics Import and Export
Next
From: Julien Tachoires
Date:
Subject: Re: Compress ReorderBuffer spill files using LZ4