pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
11+ messages / 4 participants
[nested] [flat]
* BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-08 18:20 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 11+ messages in thread
From: PG Bug reporting form @ 2026-10-08 18:20 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: mertkul669@gmail.com
The following bug has been logged on the website:
Bug reference: 19752
Logged by: Mert Kul
Email address: mertkul669@gmail.com
PostgreSQL version: 18.4
Operating system: Ubuntu
Description:
Hi,
I found a planner crash (SIGSEGV) in PostgreSQL 18 with the following
query:
SELECT ARRAY[]::varchar(500)[]
GROUP BY CAST('true' AS boolean);
Tested on 18.6 (REL_18_STABLE at 1370a7832a). The query works on 17.11.
No tables or data are required, and EXPLAIN alone is enough to reproduce
the crash, so the executor proper is never reached. The planner does,
however, call executor expression-evaluation code while constant-folding
the expression.
I first hit the crash with a LEFT JOIN query, but the FROM clause and the
join are not required.
Reproduction (unpatched 18.6)
ARRAY[]::varchar(500)[] GROUP BY CAST('true' AS boolean) crash
ARRAY[]::char(1)[] GROUP BY CAST('true' AS boolean) crash
ARRAY[]::varchar(500)[] without GROUP BY ok
ARRAY[]::varchar[] GROUP BY ... (no typmod) ok
ARRAY[]::text[] GROUP BY ... ok
ARRAY['a']::varchar(500)[] GROUP BY ... (non-empty array) ok
The crash needs both a constant GROUP BY expression and an array whose
element type requires length coercion, such as varchar(n) or char(n).
Backtrace (18.6, assert-enabled, -O0)
#0 slot_getsomeattrs (slot=0x0, attnum=1) at tuptable.h:361
#1 ExecInterpExpr (...) at execExprInterp.c:664
#2 ExecInterpExprStillValid (...) at execExprInterp.c:2307
#3 ExecEvalExprSwitchContext (...) at executor.h:440
#4 evaluate_expr (expr=..., result_type=1015, result_typmod=504,
result_collation=100) at clauses.c:5082
#5 eval_const_expressions_mutator (node=<ArrayCoerceExpr>, ...)
at clauses.c:3155
#6 expression_tree_mutator_impl (...)
#7 eval_const_expressions_mutator (...) at clauses.c:3797
#8 expression_tree_mutator_impl (...)
#9 eval_const_expressions_mutator (...) at clauses.c:3797
#10 eval_const_expressions (...) at clauses.c:2295
#11 preprocess_expression (..., kind=1) at planner.c:1348
#12 subquery_planner (...) at planner.c:919
Cause
For ARRAY[]::varchar(500)[], the parser builds an ArrayCoerceExpr whose
elemexpr is a per-element template:
varchar(CaseTestExpr, 500, true)
where the final "true" is the internal isExplicit flag.
substitute_grouped_columns_mutator() in parse_agg.c replaces any
subexpression that equal()s a GROUP BY expression with a Var referencing
the RTE_GROUP RTE. It also descends into elemexpr. The GROUP BY
expression is Const(bool, true), and the internal isExplicit flag is also
Const(bool, true), so the flag is wrongly replaced by a Var. (Dumping
elemexpr at the point of failure on 18.4 shows the third argument is a
VAR rather than a CONST.)
eval_const_expressions_mutator() then sees an ArrayCoerceExpr with a
Const argument and no volatile functions in elemexpr, and folds it
through evaluate_expr(). ExecInitExprRec() assumes elemexpr contains no
Var, but the substitution above violates that assumption. The Var is
evaluated without a tuple slot, which dereferences NULL.
Why 17 is not affected
In 17, check_ungrouped_columns_walker() performs the same equal() check,
but a match only stops the descent; the expression tree is not rewritten.
Commit 247dea89f ("Introduce an RTE for the grouping step") made a match
rewrite the tree, without skipping these template fields.
The ArrayCoerceExpr folding code in clauses.c is identical in 17 and 18,
so the relevant change is on the parser side, in parse_agg.c.
Thanks,
Mert Kul
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-08 19:31 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 11+ messages in thread
From: Tom Lane @ 2026-10-08 19:31 UTC (permalink / raw)
To: mertkul669@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org, Richard Guo <guofenglinux@gmail.com>
PG Bug reporting form <noreply@postgresql.org> writes:
> I found a planner crash (SIGSEGV) in PostgreSQL 18 with the following
> query:
> SELECT ARRAY[]::varchar(500)[]
> GROUP BY CAST('true' AS boolean);
> Cause
> For ARRAY[]::varchar(500)[], the parser builds an ArrayCoerceExpr whose
> elemexpr is a per-element template:
> varchar(CaseTestExpr, 500, true)
> where the final "true" is the internal isExplicit flag.
> substitute_grouped_columns_mutator() in parse_agg.c replaces any
> subexpression that equal()s a GROUP BY expression with a Var referencing
> the RTE_GROUP RTE. It also descends into elemexpr. The GROUP BY
> expression is Const(bool, true), and the internal isExplicit flag is also
> Const(bool, true), so the flag is wrongly replaced by a Var. (Dumping
> elemexpr at the point of failure on 18.4 shows the third argument is a
> VAR rather than a CONST.)
Yeah, that's nasty, and what's nastier is that even non-crash cases
might result in seriously wrong answers. We shouldn't be replacing
constant subexpressions by group Vars ever. I'm inclined to think
that GROUP BY items should not be candidates for this
search-and-replace unless they contain at least one level-zero Var.
But maybe that's too simplistic?
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-08 19:48 Andrey Rachitskiy <pl0h0yp1@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: Andrey Rachitskiy @ 2026-10-08 19:48 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: mertkul669@gmail.com, pgsql-bugs@lists.postgresql.org, Richard Guo <guofenglinux@gmail.com>
пт, 9 окт. 2026 г. в 00:32, Tom Lane <tgl@sss.pgh.pa.us>:
> PG Bug reporting form <noreply@postgresql.org> writes:
> > I found a planner crash (SIGSEGV) in PostgreSQL 18 with the following
> > query:
>
> > SELECT ARRAY[]::varchar(500)[]
> > GROUP BY CAST('true' AS boolean);
>
> > Cause
> > For ARRAY[]::varchar(500)[], the parser builds an ArrayCoerceExpr whose
> > elemexpr is a per-element template:
> > varchar(CaseTestExpr, 500, true)
> > where the final "true" is the internal isExplicit flag.
> > substitute_grouped_columns_mutator() in parse_agg.c replaces any
> > subexpression that equal()s a GROUP BY expression with a Var referencing
> > the RTE_GROUP RTE. It also descends into elemexpr. The GROUP BY
> > expression is Const(bool, true), and the internal isExplicit flag is also
> > Const(bool, true), so the flag is wrongly replaced by a Var. (Dumping
> > elemexpr at the point of failure on 18.4 shows the third argument is a
> > VAR rather than a CONST.)
>
> Yeah, that's nasty, and what's nastier is that even non-crash cases
> might result in seriously wrong answers. We shouldn't be replacing
> constant subexpressions by group Vars ever. I'm inclined to think
> that GROUP BY items should not be candidates for this
> search-and-replace unless they contain at least one level-zero Var.
> But maybe that's too simplistic?
>
> regards, tom lane
>
>
>
Hi, Tom!
If I analyzed the code correctly, the conclusions are as follows:
We should still replace the grouped constant itself. Bisect puts the
crash at f5050f795ae ("Mark expressions nullable by grouping sets"),
whose parent 247dea89f76 does not crash. 247dea89f76 returns on Const
before equal(). f5050f795ae moves that return to after equal(), and
the comment says why. A GROUP BY constant is no longer constant after
the grouping step. The regress query added in that commit is
select 1 as one group by rollup(one) order by one nulls first;
and the expected result is a null row followed by 1.
Skipping every GROUP BY item that contains no level-zero Var is too
broad. The item in that query is a Const, so it contains no Var, and
the commit exists to keep it a candidate. The constants that must not
be replaced are the other Const nodes that happen to compare equal.
--
Regards,
Rachitskiy Andrey
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-08 20:10 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andrey Rachitskiy <pl0h0yp1@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Tom Lane @ 2026-10-08 20:10 UTC (permalink / raw)
To: Andrey Rachitskiy <pl0h0yp1@gmail.com>; +Cc: mertkul669@gmail.com, pgsql-bugs@lists.postgresql.org, Richard Guo <guofenglinux@gmail.com>
Andrey Rachitskiy <pl0h0yp1@gmail.com> writes:
> пт, 9 окт. 2026 г. в 00:32, Tom Lane <tgl@sss.pgh.pa.us>:
>> Yeah, that's nasty, and what's nastier is that even non-crash cases
>> might result in seriously wrong answers. We shouldn't be replacing
>> constant subexpressions by group Vars ever. I'm inclined to think
>> that GROUP BY items should not be candidates for this
>> search-and-replace unless they contain at least one level-zero Var.
>> But maybe that's too simplistic?
> We should still replace the grouped constant itself. Bisect puts the
> crash at f5050f795ae ("Mark expressions nullable by grouping sets"),
> whose parent 247dea89f76 does not crash. 247dea89f76 returns on Const
> before equal(). f5050f795ae moves that return to after equal(), and
> the comment says why. A GROUP BY constant is no longer constant after
> the grouping step. The regress query added in that commit is
> select 1 as one group by rollup(one) order by one nulls first;
I think that's different: the "group by one" should identify the
first TLE and nothing else. Otherwise we have insanities like
select 1 as one, 1+2 as three group by rollup(one)
affecting both columns. (I see that it does not, right now,
but it's hard to argue why not if you think replacing constants
is okay.)
> Skipping every GROUP BY item that contains no level-zero Var is too
> broad. The item in that query is a Const, so it contains no Var, and
> the commit exists to keep it a candidate. The constants that must not
> be replaced are the other Const nodes that happen to compare equal.
We might need to special-case TLEs that are identified this way.
The basic problem is how do you tell which Consts are okay to replace,
and what I'm saying is "none of them, except the identified TLE".
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-08 21:21 Andrey Rachitskiy <pl0h0yp1@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 11+ messages in thread
From: Andrey Rachitskiy @ 2026-10-08 21:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: mertkul669@gmail.com, pgsql-bugs@lists.postgresql.org, Richard Guo <guofenglinux@gmail.com>
пт, 9 окт. 2026 г. в 01:10, Tom Lane <tgl@sss.pgh.pa.us>:
>
> > Skipping every GROUP BY item that contains no level-zero Var is too
> > broad. The item in that query is a Const, so it contains no Var, and
> > the commit exists to keep it a candidate. The constants that must not
> > be replaced are the other Const nodes that happen to compare equal.
>
> We might need to special-case TLEs that are identified this way.
> The basic problem is how do you tell which Consts are okay to replace,
> and what I'm saying is "none of them, except the identified TLE".
>
>
Agreed.
None of the Consts should be replaced, except the targetlist
entry that GROUP BY identified.
That entry already carries a ressortgroupref. When its expression is a
Const or Param, substitute_grouped_columns_mutator() replaces the entry
as a whole. The match is on ressortgroupref, because groupClauses may
be a copy after join alias flattening. These items are skipped in the
equal() loop, so the same value elsewhere stays a constant. Param
takes the same path as Const, since the existing code accepts the two
together.
select 1 as one group by rollup(one) order by one nulls first still
returns a null row and then 1.
select 1 as one, 1+2 as three group by rollup(one) leaves three as 3.
The reported query no longer crashes.
GROUP BY true identified the boolean constant, and the true inside
ArrayCoerceExpr.elemexpr was a different Const.
Patch attached.
--
Regards,
Rachitskiy Andrey
Attachments:
0001-Match-Const-GROUP-BY-items-by-targetlist-entry.patch (text/x-patch, 4.0K) download
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index a5424c9d24c..6834a3cb4c1 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -1424,6 +1424,37 @@ substitute_grouped_columns_mutator(Node *node,
return node;
}
+ /*
+ * GROUP BY of a Const or Param refers to one targetlist entry. Other
+ * occurrences of the same value are not that column, so they must not
+ * be replaced.
+ */
+ if (context->sublevels_up == 0 &&
+ context->have_non_var_grouping &&
+ IsA(node, TargetEntry))
+ {
+ TargetEntry *tle = (TargetEntry *) node;
+ int attnum = 0;
+
+ foreach(gl, context->groupClauses)
+ {
+ TargetEntry *grouptle = (TargetEntry *) lfirst(gl);
+
+ attnum++;
+ if (tle->ressortgroupref == grouptle->ressortgroupref &&
+ grouptle->ressortgroupref != 0 &&
+ (IsA(grouptle->expr, Const) || IsA(grouptle->expr, Param)))
+ {
+ TargetEntry *newtle = copyObject(tle);
+
+ newtle->expr = (Expr *) buildGroupedVar(attnum,
+ grouptle->ressortgroupref,
+ context);
+ return (Node *) newtle;
+ }
+ }
+ }
+
/*
* If we have any GROUP BY items that are not simple Vars, check to see if
* subexpression as a whole matches any GROUP BY item. We need to do this
@@ -1448,6 +1479,13 @@ substitute_grouped_columns_mutator(Node *node,
TargetEntry *tle = (TargetEntry *) lfirst(gl);
attnum++;
+
+ /*
+ * Const and Param items were matched by targetlist entry above.
+ */
+ if (IsA(tle->expr, Const) || IsA(tle->expr, Param))
+ continue;
+
if (equal(node, tle->expr))
{
/* acceptable, replace it with a GROUP Var */
@@ -1459,10 +1497,9 @@ substitute_grouped_columns_mutator(Node *node,
}
/*
- * Constants are always acceptable. We have to do this after we checked
- * the subexpression as a whole for a match, because it is possible that
- * we have GROUP BY items that are constants, and the constants would
- * become not so constant after the grouping step.
+ * Constants are always acceptable. The grouped Const or Param itself
+ * was replaced with its targetlist entry. Any other constant is still
+ * constant after grouping.
*/
if (IsA(node, Const) ||
IsA(node, Param))
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out
index 08d5ce3156d..93e8c3e7307 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -2762,4 +2762,44 @@ order by 1, 2;
2 |
(6 rows)
+-- a grouped Const names one targetlist entry, not every equal Const
+select ARRAY[]::varchar(500)[] as a
+group by cast('true' as boolean);
+ a
+----
+ {}
+(1 row)
+
+select ARRAY[]::char(1)[] as a
+group by cast(true as boolean);
+ a
+----
+ {}
+(1 row)
+
+select ARRAY[]::varchar(500)[] as a
+group by cast(500 as int);
+ a
+----
+ {}
+(1 row)
+
+select 'ab'::varchar(5) as v, true as t
+group by grouping sets ((cast(true as boolean)), ())
+order by t;
+ v | t
+----+---
+ ab | t
+ ab |
+(2 rows)
+
+select ARRAY[]::varchar(5)[] as a, true as t
+group by grouping sets ((cast(true as boolean)), ())
+order by t;
+ a | t
+----+---
+ {} | t
+ {} |
+(2 rows)
+
-- end
diff --git a/src/test/regress/sql/groupingsets.sql b/src/test/regress/sql/groupingsets.sql
index c5d4ed2eb57..4afc20077a8 100644
--- a/src/test/regress/sql/groupingsets.sql
+++ b/src/test/regress/sql/groupingsets.sql
@@ -803,4 +803,22 @@ from (values (1, 1), (2, 2)) as t (a, b)
group by rollup(a, ab)
order by 1, 2;
+-- a grouped Const names one targetlist entry, not every equal Const
+select ARRAY[]::varchar(500)[] as a
+group by cast('true' as boolean);
+
+select ARRAY[]::char(1)[] as a
+group by cast(true as boolean);
+
+select ARRAY[]::varchar(500)[] as a
+group by cast(500 as int);
+
+select 'ab'::varchar(5) as v, true as t
+group by grouping sets ((cast(true as boolean)), ())
+order by t;
+
+select ARRAY[]::varchar(5)[] as a, true as t
+group by grouping sets ((cast(true as boolean)), ())
+order by t;
+
-- end
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-12 17:54 Andrey Rachitskiy <pl0h0yp1@gmail.com>
parent: Andrey Rachitskiy <pl0h0yp1@gmail.com>
1 sibling, 1 reply; 11+ messages in thread
From: Andrey Rachitskiy @ 2026-10-12 17:54 UTC (permalink / raw)
To: Mert Kul <mertkul669@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Richard Guo <guofenglinux@gmail.com>
пн, 12 окт. 2026 г. в 22:48, Mert Kul <mertkul669@gmail.com>:
> Thanks for working on this!
>
> Is this patch considered the definitive fix for the underlying issue, or
> is it more of a temporary workaround?
> In particular, do you think matching grouping expressions by *ressortgroupref
> *fully addresses the problem,
> including the potential for incorrect query results, or are further
> changes needed?
>
Hi, Mert!
We need Tom to look at my solution, he might not like it :). Although I
think I took his wishes into account.
--
Regards,
Rachitskiy Andrey
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-23 04:49 Andrey Rachitskiy <pl0h0yp1@gmail.com>
parent: Andrey Rachitskiy <pl0h0yp1@gmail.com>
0 siblings, 0 replies; 11+ messages in thread
From: Andrey Rachitskiy @ 2026-10-23 04:49 UTC (permalink / raw)
To: Mert Kul <mertkul669@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Richard Guo <guofenglinux@gmail.com>
пн, 12 окт. 2026 г., 22:54 Andrey Rachitskiy <pl0h0yp1@gmail.com>:
>
> пн, 12 окт. 2026 г. в 22:48, Mert Kul <mertkul669@gmail.com>:
>
>> Thanks for working on this!
>>
>> Is this patch considered the definitive fix for the underlying issue, or
>> is it more of a temporary workaround?
>> In particular, do you think matching grouping expressions by *ressortgroupref
>> *fully addresses the problem,
>> including the potential for incorrect query results, or are further
>> changes needed?
>>
>
> Hi, Mert!
>
> We need Tom to look at my solution, he might not like it :). Although I
> think I took his wishes into account.
>
Hi, Tom!
Could you take a look at the patch and check whether I've chosen the right
direction for the fix?
Thanks in advance for your time.
---
Regards,
Rachitskiy Andrey
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-23 15:34 Matheus Alcantara <matheusssilv97@gmail.com>
parent: Andrey Rachitskiy <pl0h0yp1@gmail.com>
1 sibling, 1 reply; 11+ messages in thread
From: Matheus Alcantara @ 2026-10-23 15:34 UTC (permalink / raw)
To: Andrey Rachitskiy <pl0h0yp1@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: mertkul669@gmail.com; pgsql-bugs@lists.postgresql.org; Richard Guo <guofenglinux@gmail.com>
On Thu Oct 8, 2026 at 6:21 PM -03, Andrey Rachitskiy wrote:
> пт, 9 окт. 2026 г. в 01:10, Tom Lane <tgl@sss.pgh.pa.us>:
>> > Skipping every GROUP BY item that contains no level-zero Var is too
>> > broad. The item in that query is a Const, so it contains no Var, and
>> > the commit exists to keep it a candidate. The constants that must not
>> > be replaced are the other Const nodes that happen to compare equal.
>>
>> We might need to special-case TLEs that are identified this way.
>> The basic problem is how do you tell which Consts are okay to replace,
>> and what I'm saying is "none of them, except the identified TLE".
>>
>>
> Agreed.
>
> None of the Consts should be replaced, except the targetlist
> entry that GROUP BY identified.
>
> That entry already carries a ressortgroupref. When its expression is a
> Const or Param, substitute_grouped_columns_mutator() replaces the entry
> as a whole. The match is on ressortgroupref, because groupClauses may
> be a copy after join alias flattening. These items are skipped in the
> equal() loop, so the same value elsewhere stays a constant. Param
> takes the same path as Const, since the existing code accepts the two
> together.
>
> select 1 as one group by rollup(one) order by one nulls first still
> returns a null row and then 1.
> select 1 as one, 1+2 as three group by rollup(one) leaves three as 3.
>
> The reported query no longer crashes.
>
> GROUP BY true identified the boolean constant, and the true inside
> ArrayCoerceExpr.elemexpr was a different Const.
>
> Patch attached.
Hi,
Thanks for working on this!
I've reviewed the attached patch and I have a few comments:
1. It seems to me that the test group by cast(500 as int) exercises
nothing. This test pass on master and on 18. I think that it's because
the typmod for varchar(500) is 504, so changing to CAST(504 as int)
trigger the issue.
2. Three of the new tests don't use grouping sets, so I'm wondering if
aggregates.sql may be a better home for them.
3. I think that the check on substitute_grouped_columns_mutator can be
written as:
if (context->sublevels_up == 0 &&
context->have_non_var_grouping &&
IsA(node, TargetEntry) &&
((TargetEntry *) node)->ressortgroupref != 0)
{
TargetEntry *tle = (TargetEntry *) node;
int attnum = 0;
foreach(gl, context->groupClauses)
{
TargetEntry *grouptle = (TargetEntry *) lfirst(gl);
attnum++;
if (tle->ressortgroupref == grouptle->ressortgroupref &&
(IsA(grouptle->expr, Const) || IsA(grouptle->expr, Param)))
...
Because most targetlist entries aren't GROUP BY, ORDER BY or DISTINCT
keys, so their ressortgroupref is 0. For those, the loop can never
match, but it still walks the whole groupClauses list. The
grouptle->ressortgroupref != 0 test inside the loop seems also redundant
since an item in groupClauses always has a nonzero ressortgroupref,
because that's how it was looked up. What it guards against is
tle->ressortgroupref being 0, and that can be checked once, outside the
loop.
4. I think that the patch only covers part of what Tom suggested. IIUC
his first suggestion was that GROUP BY items should not be candidates
for the search-and-replace unless they contain at least one level-zero
Var, and then "none of them, except the identified TLE". The patch
applies this only to plain Const and Param nodes, so other Var-free
items like 1+2, now(), an uncorrelated sublink or an outer reference
still go through the equal() matching. For example, with:
select 1+2 as three, (1+2)*10 as x group by rollup(three);
the 1+2 inside x is still replaced by a nullable grouped Var on the
parse tree. The result is correct today only because the planner happens
to not null it, which IIUC is the "it does not, right now" case that Tom
mentioned.
The crash itself can't come back through these items, since elemexpr
only contains CaseTestExpr and Consts, but it seems to me that the rule
should be based on what the item contains rather than on its node type.
Based on this I'm attaching a v2 that implements Tom's suggestion. It's
based on the same idea of matching the identified TLE by ressortgroupref
from your patch. The main changes are:
- parseCheckAggregates() records in a Bitmapset which GROUP BY items
contain no Vars of the current query level, using
contain_vars_of_level(expr, 0).
- For those items, only the targetlist entry that GROUP BY identified
is replaced as a whole, and they are skipped in the equal() loop at
every sublevel.
- Since a Const or Param can no longer match any grouping item, the
early return for them is moved back to the top of the mutator, as it
was before f5050f795ae.
--
Matheus Alcantara
EDB: https://www.enterprisedb.com
Attachments:
v2-0001-Don-t-replace-Var-free-subexpressions-with-groupe.patch (text/plain, 11.2K) download
From a612a22486486eed0511de5fb72762596d3d6209 Mon Sep 17 00:00:00 2001
From: Matheus Alcantara <mths.dev@pm.me>
Date: Fri, 23 Oct 2026 12:16:50 -0300
Subject: [PATCH v2] Don't replace Var-free subexpressions with grouped Vars
Since f5050f795ae, substitute_grouped_columns_mutator() checks every
subexpression against the GROUP BY items with equal() before accepting
Consts and Params, so that a constant grouping item is marked nullable
by grouping sets. But that also replaces any other Const that merely
happens to be equal to a constant grouping item. Such a Const may be in
a place where Vars are not allowed, such as the elemexpr of an
ArrayCoerceExpr, where the isExplicit flag of a length-coercion function
is a boolean Const. For example:
SELECT ARRAY[]::varchar(500)[] GROUP BY CAST('true' AS boolean);
crashed the planner, because constant-folding evaluated a Var without a
tuple slot.
A grouping expression that contains no Vars of the current query level
is not a reference to any column of the input, so an equal expression
elsewhere in the query is not a reference to that grouping column. Treat
such grouping expressions as referring only to the targetlist entry that
GROUP BY identified: replace that entry as a whole, and leave them out
of the equal() matching altogether. This covers constants, Params, outer
references and Var-free expressions such as 1+2. With that, a Const or
Param node can never match a grouping item, so accept them at the top of
the mutator again, as before f5050f795ae.
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Co-authored-by: Matheus Alcantara <matheusssilv97@gmail.com>
---
src/backend/parser/parse_agg.c | 74 +++++++++++++++++++---
src/test/regress/expected/groupingsets.out | 56 ++++++++++++++++
src/test/regress/sql/groupingsets.sql | 20 ++++++
3 files changed, 140 insertions(+), 10 deletions(-)
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index a5424c9d24c..af54d6d576a 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -53,6 +53,8 @@ typedef struct
List *groupClauseSubLevels; /* list of lists of TargetEntry */
List *gset_common; /* integer list of sortgrouprefs */
bool have_non_var_grouping;
+ Bitmapset *varfree_grouping; /* groupClauses items with no level-zero
+ * Vars, by position */
List **func_grouped_rels;
int sublevels_up;
bool in_agg_direct_args;
@@ -69,6 +71,7 @@ static Node *substitute_grouped_columns(Node *node, ParseState *pstate, Query *q
List *groupClauses, List *groupClauseCommonVars,
List *gset_common,
bool have_non_var_grouping,
+ Bitmapset *varfree_grouping,
List **func_grouped_rels);
static Node *substitute_grouped_columns_mutator(Node *node,
substitute_grouped_columns_context *context);
@@ -1142,8 +1145,10 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
List *groupClauses = NIL;
List *groupClauseCommonVars = NIL;
bool have_non_var_grouping;
+ Bitmapset *varfree_grouping = NULL;
List *func_grouped_rels = NIL;
ListCell *l;
+ int attnum;
bool hasJoinRTEs;
bool hasSelfRefRTEs;
Node *clause;
@@ -1267,12 +1272,22 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
* Track Vars that are included in all grouping sets separately in
* groupClauseCommonVars, since these are the only ones we can use to
* check for functional dependencies.
+ *
+ * Also remember which grouping expressions contain no Vars of this query
+ * level (constants, Params, outer references and the like). Those can
+ * only be referenced through the targetlist entry that GROUP BY
+ * identified; see substitute_grouped_columns_mutator.
*/
have_non_var_grouping = false;
+ attnum = 0;
foreach(l, groupClauses)
{
TargetEntry *tle = lfirst(l);
+ attnum++;
+ if (!contain_vars_of_level((Node *) tle->expr, 0))
+ varfree_grouping = bms_add_member(varfree_grouping, attnum);
+
if (!IsA(tle->expr, Var))
{
have_non_var_grouping = true;
@@ -1308,6 +1323,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
groupClauses, groupClauseCommonVars,
gset_common,
have_non_var_grouping,
+ varfree_grouping,
&func_grouped_rels);
clause = (Node *) qry->havingQual;
@@ -1321,6 +1337,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
groupClauses, groupClauseCommonVars,
gset_common,
have_non_var_grouping,
+ varfree_grouping,
&func_grouped_rels);
/*
@@ -1351,6 +1368,7 @@ substitute_grouped_columns(Node *node, ParseState *pstate, Query *qry,
List *groupClauses, List *groupClauseCommonVars,
List *gset_common,
bool have_non_var_grouping,
+ Bitmapset *varfree_grouping,
List **func_grouped_rels)
{
substitute_grouped_columns_context context;
@@ -1363,6 +1381,7 @@ substitute_grouped_columns(Node *node, ParseState *pstate, Query *qry,
context.groupClauseSubLevels = NIL;
context.gset_common = gset_common;
context.have_non_var_grouping = have_non_var_grouping;
+ context.varfree_grouping = varfree_grouping;
context.func_grouped_rels = func_grouped_rels;
context.sublevels_up = 0;
context.in_agg_direct_args = false;
@@ -1377,6 +1396,9 @@ substitute_grouped_columns_mutator(Node *node,
if (node == NULL)
return NULL;
+ if (IsA(node, Const) ||
+ IsA(node, Param))
+ return node; /* constants are always acceptable */
if (IsA(node, Aggref))
{
@@ -1424,6 +1446,42 @@ substitute_grouped_columns_mutator(Node *node,
return node;
}
+ /*
+ * A grouping expression that contains no Vars of this query level, such
+ * as a constant, refers only to the targetlist entry that GROUP BY
+ * identified. Other occurrences of an equal expression are not
+ * references to that grouping column, so they are not candidates for the
+ * equal() matching below. Replacing them would be wrong anyway: they can
+ * appear in places where Vars are not allowed, such as the elemexpr of an
+ * ArrayCoerceExpr.
+ */
+ if (IsA(node, TargetEntry) &&
+ ((TargetEntry *) node)->ressortgroupref != 0 &&
+ context->have_non_var_grouping &&
+ context->sublevels_up == 0)
+ {
+ TargetEntry *tle = (TargetEntry *) node;
+ int attnum = 0;
+
+ foreach(gl, context->groupClauses)
+ {
+ TargetEntry *grouptle = (TargetEntry *) lfirst(gl);
+
+ attnum++;
+ if (grouptle->ressortgroupref != tle->ressortgroupref)
+ continue;
+ if (bms_is_member(attnum, context->varfree_grouping))
+ {
+ tle = flatCopyTargetEntry(tle);
+ tle->expr = (Expr *) buildGroupedVar(attnum,
+ tle->ressortgroupref,
+ context);
+ return (Node *) tle;
+ }
+ break;
+ }
+ }
+
/*
* If we have any GROUP BY items that are not simple Vars, check to see if
* subexpression as a whole matches any GROUP BY item. We need to do this
@@ -1448,6 +1506,11 @@ substitute_grouped_columns_mutator(Node *node,
TargetEntry *tle = (TargetEntry *) lfirst(gl);
attnum++;
+
+ /* Var-free items are matched only by targetlist entry, above */
+ if (bms_is_member(attnum, context->varfree_grouping))
+ continue;
+
if (equal(node, tle->expr))
{
/* acceptable, replace it with a GROUP Var */
@@ -1458,16 +1521,6 @@ substitute_grouped_columns_mutator(Node *node,
}
}
- /*
- * Constants are always acceptable. We have to do this after we checked
- * the subexpression as a whole for a match, because it is possible that
- * we have GROUP BY items that are constants, and the constants would
- * become not so constant after the grouping step.
- */
- if (IsA(node, Const) ||
- IsA(node, Param))
- return node;
-
/*
* If we have an ungrouped Var of the original query level, we have a
* failure. Vars below the original query level are not a problem, and
@@ -1624,6 +1677,7 @@ finalize_grouping_exprs(Node *node, ParseState *pstate, Query *qry,
context.groupClauseSubLevels = NIL;
context.gset_common = NIL;
context.have_non_var_grouping = have_non_var_grouping;
+ context.varfree_grouping = NULL;
context.func_grouped_rels = NULL;
context.sublevels_up = 0;
context.in_agg_direct_args = false;
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out
index 08d5ce3156d..7725dec0a59 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -2667,6 +2667,62 @@ select 1 as one group by rollup(one) order by one nulls first;
1
(2 rows)
+-- A grouping expression containing no Vars of the query level refers only
+-- to the targetlist entry GROUP BY identified; equal expressions elsewhere
+-- must not be replaced by grouped Vars (this used to crash)
+select array[]::varchar(500)[] as a group by cast('true' as boolean);
+ a
+----
+ {}
+(1 row)
+
+select array[]::varchar(500)[] as a group by 504::int4;
+ a
+----
+ {}
+(1 row)
+
+select (select array[]::varchar(500)[]) as a
+group by rollup(cast('true' as boolean));
+ a
+----
+ {}
+ {}
+(2 rows)
+
+explain (verbose, costs off)
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c);
+ QUERY PLAN
+---------------------------
+ MixedAggregate
+ Output: (1), 1, (3), 30
+ Hash Key: 1, 3
+ Hash Key: 1
+ Group Key: ()
+ -> Result
+ Output: 1, 3
+(7 rows)
+
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c)
+order by a nulls first, c nulls first;
+ a | b | c | d
+---+---+---+----
+ | 1 | | 30
+ 1 | 1 | | 30
+ 1 | 1 | 3 | 30
+(3 rows)
+
+-- likewise for an outer reference used as a grouping expression
+select array(select o.a as k from (values (1)) as i (x)
+ group by rollup(o.a, x+0) order by 1 nulls first)
+from (values (10)) as o (a);
+ array
+--------------
+ {NULL,10,10}
+(1 row)
+
explain (costs off)
select a, b, row_number() over (order by a, b nulls first)
from (values (1, 1), (2, 2)) as t (a, b) where a = b
diff --git a/src/test/regress/sql/groupingsets.sql b/src/test/regress/sql/groupingsets.sql
index c5d4ed2eb57..22b8c517feb 100644
--- a/src/test/regress/sql/groupingsets.sql
+++ b/src/test/regress/sql/groupingsets.sql
@@ -771,6 +771,26 @@ explain (costs off)
select 1 as one group by rollup(one) order by one nulls first;
select 1 as one group by rollup(one) order by one nulls first;
+-- A grouping expression containing no Vars of the query level refers only
+-- to the targetlist entry GROUP BY identified; equal expressions elsewhere
+-- must not be replaced by grouped Vars (this used to crash)
+select array[]::varchar(500)[] as a group by cast('true' as boolean);
+select array[]::varchar(500)[] as a group by 504::int4;
+select (select array[]::varchar(500)[]) as a
+group by rollup(cast('true' as boolean));
+
+explain (verbose, costs off)
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c);
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c)
+order by a nulls first, c nulls first;
+
+-- likewise for an outer reference used as a grouping expression
+select array(select o.a as k from (values (1)) as i (x)
+ group by rollup(o.a, x+0) order by 1 nulls first)
+from (values (10)) as o (a);
+
explain (costs off)
select a, b, row_number() over (order by a, b nulls first)
from (values (1, 1), (2, 2)) as t (a, b) where a = b
--
2.50.1 (Apple Git-155)
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-26 09:16 Andrey Rachitskiy <pl0h0yp1@gmail.com>
parent: Matheus Alcantara <matheusssilv97@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Andrey Rachitskiy @ 2026-10-26 09:16 UTC (permalink / raw)
To: Matheus Alcantara <matheusssilv97@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; mertkul669@gmail.com, pgsql-bugs@lists.postgresql.org, Richard Guo <guofenglinux@gmail.com>
пт, 23 окт. 2026 г. в 20:34, Matheus Alcantara <matheusssilv97@gmail.com>:
> On Thu Oct 8, 2026 at 6:21 PM -03, Andrey Rachitskiy wrote:
> > пт, 9 окт. 2026 г. в 01:10, Tom Lane <tgl@sss.pgh.pa.us>:
> >> > Skipping every GROUP BY item that contains no level-zero Var is too
> >> > broad. The item in that query is a Const, so it contains no Var, and
> >> > the commit exists to keep it a candidate. The constants that must not
> >> > be replaced are the other Const nodes that happen to compare equal.
> >>
> >> We might need to special-case TLEs that are identified this way.
> >> The basic problem is how do you tell which Consts are okay to replace,
> >> and what I'm saying is "none of them, except the identified TLE".
> >>
> >>
> > Agreed.
> >
> > None of the Consts should be replaced, except the targetlist
> > entry that GROUP BY identified.
> >
> > That entry already carries a ressortgroupref. When its expression is a
> > Const or Param, substitute_grouped_columns_mutator() replaces the entry
> > as a whole. The match is on ressortgroupref, because groupClauses may
> > be a copy after join alias flattening. These items are skipped in the
> > equal() loop, so the same value elsewhere stays a constant. Param
> > takes the same path as Const, since the existing code accepts the two
> > together.
> >
> > select 1 as one group by rollup(one) order by one nulls first still
> > returns a null row and then 1.
> > select 1 as one, 1+2 as three group by rollup(one) leaves three as 3.
> >
> > The reported query no longer crashes.
> >
> > GROUP BY true identified the boolean constant, and the true inside
> > ArrayCoerceExpr.elemexpr was a different Const.
> >
> > Patch attached.
>
> Hi,
>
> Thanks for working on this!
>
> I've reviewed the attached patch and I have a few comments:
>
> 1. It seems to me that the test group by cast(500 as int) exercises
> nothing. This test pass on master and on 18. I think that it's because
> the typmod for varchar(500) is 504, so changing to CAST(504 as int)
> trigger the issue.
>
> 2. Three of the new tests don't use grouping sets, so I'm wondering if
> aggregates.sql may be a better home for them.
>
> 3. I think that the check on substitute_grouped_columns_mutator can be
> written as:
>
> if (context->sublevels_up == 0 &&
> context->have_non_var_grouping &&
> IsA(node, TargetEntry) &&
> ((TargetEntry *) node)->ressortgroupref != 0)
> {
> TargetEntry *tle = (TargetEntry *) node;
> int attnum = 0;
>
> foreach(gl, context->groupClauses)
> {
> TargetEntry *grouptle = (TargetEntry *) lfirst(gl);
>
> attnum++;
> if (tle->ressortgroupref == grouptle->ressortgroupref &&
> (IsA(grouptle->expr, Const) || IsA(grouptle->expr, Param)))
> ...
>
> Because most targetlist entries aren't GROUP BY, ORDER BY or DISTINCT
> keys, so their ressortgroupref is 0. For those, the loop can never
> match, but it still walks the whole groupClauses list. The
> grouptle->ressortgroupref != 0 test inside the loop seems also redundant
> since an item in groupClauses always has a nonzero ressortgroupref,
> because that's how it was looked up. What it guards against is
> tle->ressortgroupref being 0, and that can be checked once, outside the
> loop.
>
> 4. I think that the patch only covers part of what Tom suggested. IIUC
> his first suggestion was that GROUP BY items should not be candidates
> for the search-and-replace unless they contain at least one level-zero
> Var, and then "none of them, except the identified TLE". The patch
> applies this only to plain Const and Param nodes, so other Var-free
> items like 1+2, now(), an uncorrelated sublink or an outer reference
> still go through the equal() matching. For example, with:
>
> select 1+2 as three, (1+2)*10 as x group by rollup(three);
>
> the 1+2 inside x is still replaced by a nullable grouped Var on the
> parse tree. The result is correct today only because the planner happens
> to not null it, which IIUC is the "it does not, right now" case that Tom
> mentioned.
>
> The crash itself can't come back through these items, since elemexpr
> only contains CaseTestExpr and Consts, but it seems to me that the rule
> should be based on what the item contains rather than on its node type.
>
> Based on this I'm attaching a v2 that implements Tom's suggestion. It's
> based on the same idea of matching the identified TLE by ressortgroupref
> from your patch. The main changes are:
>
> - parseCheckAggregates() records in a Bitmapset which GROUP BY items
> contain no Vars of the current query level, using
> contain_vars_of_level(expr, 0).
>
> - For those items, only the targetlist entry that GROUP BY identified
> is replaced as a whole, and they are skipped in the equal() loop at
> every sublevel.
>
> - Since a Const or Param can no longer match any grouping item, the
> early return for them is moved back to the top of the mutator, as it
> was before f5050f795ae.
>
> --
> Matheus Alcantara
> EDB: https://www.enterprisedb.com
Hi Matheus,
Thanks for the review and the v2. You understood Tom better than I did. v3
keeps the same code.
The queries that do not use grouping sets moved to aggregates.sql.
--
Regards,
Rachitskiy Andrey
Attachments:
v3-0001-Don-t-replace-Var-free-subexpressions-with-grouped-V.patch (text/x-patch, 12.1K) download
From f8d005d9af6355f9788994360c177ae68c774e7b Mon Sep 17 00:00:00 2001
From: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Date: Mon, 26 Oct 2026 14:00:07 +0500
Subject: [PATCH v3] Don't replace Var-free subexpressions with grouped Vars
Since f5050f795ae, substitute_grouped_columns_mutator() checks every
subexpression against the GROUP BY items with equal() before accepting
Consts and Params. A constant grouping item is then marked nullable by
grouping sets. The same match also replaces any other Const that
happens to be equal. Such a Const may sit where Vars are not allowed,
such as the elemexpr of an ArrayCoerceExpr. The isExplicit flag of a
length coercion is a boolean Const. For example:
SELECT ARRAY[]::varchar(500)[] GROUP BY CAST('true' AS boolean);
crashed the planner, because constant-folding evaluated a Var without a
tuple slot.
A grouping expression that contains no Vars of the current query level
is not a reference to any input column. An equal expression elsewhere
is not a reference to that grouping column. Replace only the targetlist
entry that GROUP BY identified, and leave these items out of the equal()
search. This covers constants, Params and Var-free expressions such as
1+2. A Const or Param can no longer match a grouping item, so accept
them at the top of the mutator again, as before f5050f795ae.
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Co-authored-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://www.postgresql.org/message-id/19752-928339cd23b58a33@postgresql.org
---
src/backend/parser/parse_agg.c | 74 +++++++++++++++++++---
src/test/regress/expected/aggregates.out | 13 ++++
src/test/regress/expected/groupingsets.out | 44 +++++++++++++
src/test/regress/sql/aggregates.sql | 4 ++
src/test/regress/sql/groupingsets.sql | 18 ++++++
5 files changed, 143 insertions(+), 10 deletions(-)
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index a5424c9d24c..af54d6d576a 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -53,6 +53,8 @@ typedef struct
List *groupClauseSubLevels; /* list of lists of TargetEntry */
List *gset_common; /* integer list of sortgrouprefs */
bool have_non_var_grouping;
+ Bitmapset *varfree_grouping; /* groupClauses items with no level-zero
+ * Vars, by position */
List **func_grouped_rels;
int sublevels_up;
bool in_agg_direct_args;
@@ -69,6 +71,7 @@ static Node *substitute_grouped_columns(Node *node, ParseState *pstate, Query *q
List *groupClauses, List *groupClauseCommonVars,
List *gset_common,
bool have_non_var_grouping,
+ Bitmapset *varfree_grouping,
List **func_grouped_rels);
static Node *substitute_grouped_columns_mutator(Node *node,
substitute_grouped_columns_context *context);
@@ -1142,8 +1145,10 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
List *groupClauses = NIL;
List *groupClauseCommonVars = NIL;
bool have_non_var_grouping;
+ Bitmapset *varfree_grouping = NULL;
List *func_grouped_rels = NIL;
ListCell *l;
+ int attnum;
bool hasJoinRTEs;
bool hasSelfRefRTEs;
Node *clause;
@@ -1267,12 +1272,22 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
* Track Vars that are included in all grouping sets separately in
* groupClauseCommonVars, since these are the only ones we can use to
* check for functional dependencies.
+ *
+ * Also remember which grouping expressions contain no Vars of this query
+ * level (constants, Params, outer references and the like). Those can
+ * only be referenced through the targetlist entry that GROUP BY
+ * identified; see substitute_grouped_columns_mutator.
*/
have_non_var_grouping = false;
+ attnum = 0;
foreach(l, groupClauses)
{
TargetEntry *tle = lfirst(l);
+ attnum++;
+ if (!contain_vars_of_level((Node *) tle->expr, 0))
+ varfree_grouping = bms_add_member(varfree_grouping, attnum);
+
if (!IsA(tle->expr, Var))
{
have_non_var_grouping = true;
@@ -1308,6 +1323,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
groupClauses, groupClauseCommonVars,
gset_common,
have_non_var_grouping,
+ varfree_grouping,
&func_grouped_rels);
clause = (Node *) qry->havingQual;
@@ -1321,6 +1337,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
groupClauses, groupClauseCommonVars,
gset_common,
have_non_var_grouping,
+ varfree_grouping,
&func_grouped_rels);
/*
@@ -1351,6 +1368,7 @@ substitute_grouped_columns(Node *node, ParseState *pstate, Query *qry,
List *groupClauses, List *groupClauseCommonVars,
List *gset_common,
bool have_non_var_grouping,
+ Bitmapset *varfree_grouping,
List **func_grouped_rels)
{
substitute_grouped_columns_context context;
@@ -1363,6 +1381,7 @@ substitute_grouped_columns(Node *node, ParseState *pstate, Query *qry,
context.groupClauseSubLevels = NIL;
context.gset_common = gset_common;
context.have_non_var_grouping = have_non_var_grouping;
+ context.varfree_grouping = varfree_grouping;
context.func_grouped_rels = func_grouped_rels;
context.sublevels_up = 0;
context.in_agg_direct_args = false;
@@ -1377,6 +1396,9 @@ substitute_grouped_columns_mutator(Node *node,
if (node == NULL)
return NULL;
+ if (IsA(node, Const) ||
+ IsA(node, Param))
+ return node; /* constants are always acceptable */
if (IsA(node, Aggref))
{
@@ -1424,6 +1446,42 @@ substitute_grouped_columns_mutator(Node *node,
return node;
}
+ /*
+ * A grouping expression that contains no Vars of this query level, such
+ * as a constant, refers only to the targetlist entry that GROUP BY
+ * identified. Other occurrences of an equal expression are not
+ * references to that grouping column, so they are not candidates for the
+ * equal() matching below. Replacing them would be wrong anyway: they can
+ * appear in places where Vars are not allowed, such as the elemexpr of an
+ * ArrayCoerceExpr.
+ */
+ if (IsA(node, TargetEntry) &&
+ ((TargetEntry *) node)->ressortgroupref != 0 &&
+ context->have_non_var_grouping &&
+ context->sublevels_up == 0)
+ {
+ TargetEntry *tle = (TargetEntry *) node;
+ int attnum = 0;
+
+ foreach(gl, context->groupClauses)
+ {
+ TargetEntry *grouptle = (TargetEntry *) lfirst(gl);
+
+ attnum++;
+ if (grouptle->ressortgroupref != tle->ressortgroupref)
+ continue;
+ if (bms_is_member(attnum, context->varfree_grouping))
+ {
+ tle = flatCopyTargetEntry(tle);
+ tle->expr = (Expr *) buildGroupedVar(attnum,
+ tle->ressortgroupref,
+ context);
+ return (Node *) tle;
+ }
+ break;
+ }
+ }
+
/*
* If we have any GROUP BY items that are not simple Vars, check to see if
* subexpression as a whole matches any GROUP BY item. We need to do this
@@ -1448,6 +1506,11 @@ substitute_grouped_columns_mutator(Node *node,
TargetEntry *tle = (TargetEntry *) lfirst(gl);
attnum++;
+
+ /* Var-free items are matched only by targetlist entry, above */
+ if (bms_is_member(attnum, context->varfree_grouping))
+ continue;
+
if (equal(node, tle->expr))
{
/* acceptable, replace it with a GROUP Var */
@@ -1458,16 +1521,6 @@ substitute_grouped_columns_mutator(Node *node,
}
}
- /*
- * Constants are always acceptable. We have to do this after we checked
- * the subexpression as a whole for a match, because it is possible that
- * we have GROUP BY items that are constants, and the constants would
- * become not so constant after the grouping step.
- */
- if (IsA(node, Const) ||
- IsA(node, Param))
- return node;
-
/*
* If we have an ungrouped Var of the original query level, we have a
* failure. Vars below the original query level are not a problem, and
@@ -1624,6 +1677,7 @@ finalize_grouping_exprs(Node *node, ParseState *pstate, Query *qry,
context.groupClauseSubLevels = NIL;
context.gset_common = NIL;
context.have_non_var_grouping = have_non_var_grouping;
+ context.varfree_grouping = NULL;
context.func_grouped_rels = NULL;
context.sublevels_up = 0;
context.in_agg_direct_args = false;
diff --git a/src/test/regress/expected/aggregates.out b/src/test/regress/expected/aggregates.out
index 7d07619956f..6c0209800e9 100644
--- a/src/test/regress/expected/aggregates.out
+++ b/src/test/regress/expected/aggregates.out
@@ -3958,3 +3958,16 @@ drop table agg_hash_1;
drop table agg_hash_2;
drop table agg_hash_3;
drop table agg_hash_4;
+
+-- check that a grouped constant does not match an equal Const elsewhere
+select array[]::varchar(500)[] as a group by cast('true' as boolean);
+ a
+----
+ {}
+(1 row)
+
+select array[]::varchar(500)[] as a group by 504::int4;
+ a
+----
+ {}
+(1 row)
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out
index 08d5ce3156d..0707efa5c37 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -2667,6 +2667,50 @@ select 1 as one group by rollup(one) order by one nulls first;
1
(2 rows)
+-- A grouping expression containing no Vars of the query level refers only
+-- to the targetlist entry GROUP BY identified. An equal expression elsewhere
+-- must not be replaced by a grouped Var.
+select (select array[]::varchar(500)[]) as a
+group by rollup(cast('true' as boolean));
+ a
+----
+ {}
+ {}
+(2 rows)
+
+explain (verbose, costs off)
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c);
+ QUERY PLAN
+---------------------------
+ MixedAggregate
+ Output: (1), 1, (3), 30
+ Hash Key: 1, 3
+ Hash Key: 1
+ Group Key: ()
+ -> Result
+ Output: 1, 3
+(7 rows)
+
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c)
+order by a nulls first, c nulls first;
+ a | b | c | d
+---+---+---+----
+ | 1 | | 30
+ 1 | 1 | | 30
+ 1 | 1 | 3 | 30
+(3 rows)
+
+-- likewise for an outer reference used as a grouping expression
+select array(select o.a as k from (values (1)) as i (x)
+ group by rollup(o.a, x+0) order by 1 nulls first)
+from (values (10)) as o (a);
+ array
+--------------
+ {NULL,10,10}
+(1 row)
+
explain (costs off)
select a, b, row_number() over (order by a, b nulls first)
from (values (1, 1), (2, 2)) as t (a, b) where a = b
diff --git a/src/test/regress/sql/aggregates.sql b/src/test/regress/sql/aggregates.sql
index 91f8342166f..3f3d3cb7604 100644
--- a/src/test/regress/sql/aggregates.sql
+++ b/src/test/regress/sql/aggregates.sql
@@ -1786,3 +1786,7 @@ drop table agg_hash_1;
drop table agg_hash_2;
drop table agg_hash_3;
drop table agg_hash_4;
+
+-- check that a grouped constant does not match an equal Const elsewhere
+select array[]::varchar(500)[] as a group by cast('true' as boolean);
+select array[]::varchar(500)[] as a group by 504::int4;
diff --git a/src/test/regress/sql/groupingsets.sql b/src/test/regress/sql/groupingsets.sql
index c5d4ed2eb57..bc3be53be5d 100644
--- a/src/test/regress/sql/groupingsets.sql
+++ b/src/test/regress/sql/groupingsets.sql
@@ -771,6 +771,24 @@ explain (costs off)
select 1 as one group by rollup(one) order by one nulls first;
select 1 as one group by rollup(one) order by one nulls first;
+-- A grouping expression containing no Vars of the query level refers only
+-- to the targetlist entry GROUP BY identified. An equal expression elsewhere
+-- must not be replaced by a grouped Var.
+select (select array[]::varchar(500)[]) as a
+group by rollup(cast('true' as boolean));
+
+explain (verbose, costs off)
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c);
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c)
+order by a nulls first, c nulls first;
+
+-- likewise for an outer reference used as a grouping expression
+select array(select o.a as k from (values (1)) as i (x)
+ group by rollup(o.a, x+0) order by 1 nulls first)
+from (values (10)) as o (a);
+
explain (costs off)
select a, b, row_number() over (order by a, b nulls first)
from (values (1, 1), (2, 2)) as t (a, b) where a = b
--
2.53.0
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-28 12:26 Matheus Alcantara <matheusssilv97@gmail.com>
parent: Andrey Rachitskiy <pl0h0yp1@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Matheus Alcantara @ 2026-10-28 12:26 UTC (permalink / raw)
To: Andrey Rachitskiy <pl0h0yp1@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; mertkul669@gmail.com, pgsql-bugs@lists.postgresql.org, Richard Guo <guofenglinux@gmail.com>
On 26/10/26 06:16, Andrey Rachitskiy wrote:
> Thanks for the review and the v2. You understood Tom better than I did. v3
> keeps the same code.
> The queries that do not use grouping sets moved to aggregates.sql.
>
Thanks for the new version.
I've created a CF entry for this bug:
https://commitfest.postgresql.org/patch/7545/
--
Matheus Alcantara
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning
@ 2026-10-28 16:43 Andrey Rachitskiy <pl0h0yp1@gmail.com>
parent: Matheus Alcantara <matheusssilv97@gmail.com>
0 siblings, 0 replies; 11+ messages in thread
From: Andrey Rachitskiy @ 2026-10-28 16:43 UTC (permalink / raw)
To: Matheus Alcantara <matheusssilv97@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; mertkul669@gmail.com, pgsql-bugs@lists.postgresql.org, Richard Guo <guofenglinux@gmail.com>
ср, 28 окт. 2026 г. в 17:26, Matheus Alcantara <matheusssilv97@gmail.com>:
>
> Thanks for the new version.
>
> I've created a CF entry for this bug:
> https://commitfest.postgresql.org/patch/7545/
>
>
Thanks!
The tests failed
https://github.com/postgres/postgres-cfbot/actions/runs/40688101550/job/122816184253
I forgot to remove the blank line. Attached the corrected ver.
--
Regards,
Rachitskiy Andrey
Attachments:
v3-0001-Don-t-replace-Var-free-subexpressions-with-grouped-V.patch (text/x-patch, 12.1K) download
From f8d005d9af6355f9788994360c177ae68c774e7b Mon Sep 17 00:00:00 2001
From: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Date: Mon, 26 Oct 2026 14:00:07 +0500
Subject: [PATCH v3] Don't replace Var-free subexpressions with grouped Vars
Since f5050f795ae, substitute_grouped_columns_mutator() checks every
subexpression against the GROUP BY items with equal() before accepting
Consts and Params. A constant grouping item is then marked nullable by
grouping sets. The same match also replaces any other Const that
happens to be equal. Such a Const may sit where Vars are not allowed,
such as the elemexpr of an ArrayCoerceExpr. The isExplicit flag of a
length coercion is a boolean Const. For example:
SELECT ARRAY[]::varchar(500)[] GROUP BY CAST('true' AS boolean);
crashed the planner, because constant-folding evaluated a Var without a
tuple slot.
A grouping expression that contains no Vars of the current query level
is not a reference to any input column. An equal expression elsewhere
is not a reference to that grouping column. Replace only the targetlist
entry that GROUP BY identified, and leave these items out of the equal()
search. This covers constants, Params and Var-free expressions such as
1+2. A Const or Param can no longer match a grouping item, so accept
them at the top of the mutator again, as before f5050f795ae.
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Co-authored-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://www.postgresql.org/message-id/19752-928339cd23b58a33@postgresql.org
---
src/backend/parser/parse_agg.c | 74 +++++++++++++++++++---
src/test/regress/expected/aggregates.out | 13 ++++
src/test/regress/expected/groupingsets.out | 44 +++++++++++++
src/test/regress/sql/aggregates.sql | 4 ++
src/test/regress/sql/groupingsets.sql | 18 ++++++
5 files changed, 143 insertions(+), 10 deletions(-)
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index a5424c9d24c..af54d6d576a 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -53,6 +53,8 @@ typedef struct
List *groupClauseSubLevels; /* list of lists of TargetEntry */
List *gset_common; /* integer list of sortgrouprefs */
bool have_non_var_grouping;
+ Bitmapset *varfree_grouping; /* groupClauses items with no level-zero
+ * Vars, by position */
List **func_grouped_rels;
int sublevels_up;
bool in_agg_direct_args;
@@ -69,6 +71,7 @@ static Node *substitute_grouped_columns(Node *node, ParseState *pstate, Query *q
List *groupClauses, List *groupClauseCommonVars,
List *gset_common,
bool have_non_var_grouping,
+ Bitmapset *varfree_grouping,
List **func_grouped_rels);
static Node *substitute_grouped_columns_mutator(Node *node,
substitute_grouped_columns_context *context);
@@ -1142,8 +1145,10 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
List *groupClauses = NIL;
List *groupClauseCommonVars = NIL;
bool have_non_var_grouping;
+ Bitmapset *varfree_grouping = NULL;
List *func_grouped_rels = NIL;
ListCell *l;
+ int attnum;
bool hasJoinRTEs;
bool hasSelfRefRTEs;
Node *clause;
@@ -1267,12 +1272,22 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
* Track Vars that are included in all grouping sets separately in
* groupClauseCommonVars, since these are the only ones we can use to
* check for functional dependencies.
+ *
+ * Also remember which grouping expressions contain no Vars of this query
+ * level (constants, Params, outer references and the like). Those can
+ * only be referenced through the targetlist entry that GROUP BY
+ * identified; see substitute_grouped_columns_mutator.
*/
have_non_var_grouping = false;
+ attnum = 0;
foreach(l, groupClauses)
{
TargetEntry *tle = lfirst(l);
+ attnum++;
+ if (!contain_vars_of_level((Node *) tle->expr, 0))
+ varfree_grouping = bms_add_member(varfree_grouping, attnum);
+
if (!IsA(tle->expr, Var))
{
have_non_var_grouping = true;
@@ -1308,6 +1323,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
groupClauses, groupClauseCommonVars,
gset_common,
have_non_var_grouping,
+ varfree_grouping,
&func_grouped_rels);
clause = (Node *) qry->havingQual;
@@ -1321,6 +1337,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
groupClauses, groupClauseCommonVars,
gset_common,
have_non_var_grouping,
+ varfree_grouping,
&func_grouped_rels);
/*
@@ -1351,6 +1368,7 @@ substitute_grouped_columns(Node *node, ParseState *pstate, Query *qry,
List *groupClauses, List *groupClauseCommonVars,
List *gset_common,
bool have_non_var_grouping,
+ Bitmapset *varfree_grouping,
List **func_grouped_rels)
{
substitute_grouped_columns_context context;
@@ -1363,6 +1381,7 @@ substitute_grouped_columns(Node *node, ParseState *pstate, Query *qry,
context.groupClauseSubLevels = NIL;
context.gset_common = gset_common;
context.have_non_var_grouping = have_non_var_grouping;
+ context.varfree_grouping = varfree_grouping;
context.func_grouped_rels = func_grouped_rels;
context.sublevels_up = 0;
context.in_agg_direct_args = false;
@@ -1377,6 +1396,9 @@ substitute_grouped_columns_mutator(Node *node,
if (node == NULL)
return NULL;
+ if (IsA(node, Const) ||
+ IsA(node, Param))
+ return node; /* constants are always acceptable */
if (IsA(node, Aggref))
{
@@ -1424,6 +1446,42 @@ substitute_grouped_columns_mutator(Node *node,
return node;
}
+ /*
+ * A grouping expression that contains no Vars of this query level, such
+ * as a constant, refers only to the targetlist entry that GROUP BY
+ * identified. Other occurrences of an equal expression are not
+ * references to that grouping column, so they are not candidates for the
+ * equal() matching below. Replacing them would be wrong anyway: they can
+ * appear in places where Vars are not allowed, such as the elemexpr of an
+ * ArrayCoerceExpr.
+ */
+ if (IsA(node, TargetEntry) &&
+ ((TargetEntry *) node)->ressortgroupref != 0 &&
+ context->have_non_var_grouping &&
+ context->sublevels_up == 0)
+ {
+ TargetEntry *tle = (TargetEntry *) node;
+ int attnum = 0;
+
+ foreach(gl, context->groupClauses)
+ {
+ TargetEntry *grouptle = (TargetEntry *) lfirst(gl);
+
+ attnum++;
+ if (grouptle->ressortgroupref != tle->ressortgroupref)
+ continue;
+ if (bms_is_member(attnum, context->varfree_grouping))
+ {
+ tle = flatCopyTargetEntry(tle);
+ tle->expr = (Expr *) buildGroupedVar(attnum,
+ tle->ressortgroupref,
+ context);
+ return (Node *) tle;
+ }
+ break;
+ }
+ }
+
/*
* If we have any GROUP BY items that are not simple Vars, check to see if
* subexpression as a whole matches any GROUP BY item. We need to do this
@@ -1448,6 +1506,11 @@ substitute_grouped_columns_mutator(Node *node,
TargetEntry *tle = (TargetEntry *) lfirst(gl);
attnum++;
+
+ /* Var-free items are matched only by targetlist entry, above */
+ if (bms_is_member(attnum, context->varfree_grouping))
+ continue;
+
if (equal(node, tle->expr))
{
/* acceptable, replace it with a GROUP Var */
@@ -1458,16 +1521,6 @@ substitute_grouped_columns_mutator(Node *node,
}
}
- /*
- * Constants are always acceptable. We have to do this after we checked
- * the subexpression as a whole for a match, because it is possible that
- * we have GROUP BY items that are constants, and the constants would
- * become not so constant after the grouping step.
- */
- if (IsA(node, Const) ||
- IsA(node, Param))
- return node;
-
/*
* If we have an ungrouped Var of the original query level, we have a
* failure. Vars below the original query level are not a problem, and
@@ -1624,6 +1677,7 @@ finalize_grouping_exprs(Node *node, ParseState *pstate, Query *qry,
context.groupClauseSubLevels = NIL;
context.gset_common = NIL;
context.have_non_var_grouping = have_non_var_grouping;
+ context.varfree_grouping = NULL;
context.func_grouped_rels = NULL;
context.sublevels_up = 0;
context.in_agg_direct_args = false;
diff --git a/src/test/regress/expected/aggregates.out b/src/test/regress/expected/aggregates.out
index 7d07619956f..6c0209800e9 100644
--- a/src/test/regress/expected/aggregates.out
+++ b/src/test/regress/expected/aggregates.out
@@ -3958,3 +3958,16 @@ drop table agg_hash_1;
drop table agg_hash_2;
drop table agg_hash_3;
drop table agg_hash_4;
+-- check that a grouped constant does not match an equal Const elsewhere
+select array[]::varchar(500)[] as a group by cast('true' as boolean);
+ a
+----
+ {}
+(1 row)
+
+select array[]::varchar(500)[] as a group by 504::int4;
+ a
+----
+ {}
+(1 row)
+
diff --git a/src/test/regress/expected/groupingsets.out b/src/test/regress/expected/groupingsets.out
index 08d5ce3156d..0707efa5c37 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -2667,6 +2667,50 @@ select 1 as one group by rollup(one) order by one nulls first;
1
(2 rows)
+-- A grouping expression containing no Vars of the query level refers only
+-- to the targetlist entry GROUP BY identified. An equal expression elsewhere
+-- must not be replaced by a grouped Var.
+select (select array[]::varchar(500)[]) as a
+group by rollup(cast('true' as boolean));
+ a
+----
+ {}
+ {}
+(2 rows)
+
+explain (verbose, costs off)
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c);
+ QUERY PLAN
+---------------------------
+ MixedAggregate
+ Output: (1), 1, (3), 30
+ Hash Key: 1, 3
+ Hash Key: 1
+ Group Key: ()
+ -> Result
+ Output: 1, 3
+(7 rows)
+
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c)
+order by a nulls first, c nulls first;
+ a | b | c | d
+---+---+---+----
+ | 1 | | 30
+ 1 | 1 | | 30
+ 1 | 1 | 3 | 30
+(3 rows)
+
+-- likewise for an outer reference used as a grouping expression
+select array(select o.a as k from (values (1)) as i (x)
+ group by rollup(o.a, x+0) order by 1 nulls first)
+from (values (10)) as o (a);
+ array
+--------------
+ {NULL,10,10}
+(1 row)
+
explain (costs off)
select a, b, row_number() over (order by a, b nulls first)
from (values (1, 1), (2, 2)) as t (a, b) where a = b
diff --git a/src/test/regress/sql/aggregates.sql b/src/test/regress/sql/aggregates.sql
index 91f8342166f..3f3d3cb7604 100644
--- a/src/test/regress/sql/aggregates.sql
+++ b/src/test/regress/sql/aggregates.sql
@@ -1786,3 +1786,7 @@ drop table agg_hash_1;
drop table agg_hash_2;
drop table agg_hash_3;
drop table agg_hash_4;
+
+-- check that a grouped constant does not match an equal Const elsewhere
+select array[]::varchar(500)[] as a group by cast('true' as boolean);
+select array[]::varchar(500)[] as a group by 504::int4;
diff --git a/src/test/regress/sql/groupingsets.sql b/src/test/regress/sql/groupingsets.sql
index c5d4ed2eb57..bc3be53be5d 100644
--- a/src/test/regress/sql/groupingsets.sql
+++ b/src/test/regress/sql/groupingsets.sql
@@ -771,6 +771,24 @@ explain (costs off)
select 1 as one group by rollup(one) order by one nulls first;
select 1 as one group by rollup(one) order by one nulls first;
+-- A grouping expression containing no Vars of the query level refers only
+-- to the targetlist entry GROUP BY identified. An equal expression elsewhere
+-- must not be replaced by a grouped Var.
+select (select array[]::varchar(500)[]) as a
+group by rollup(cast('true' as boolean));
+
+explain (verbose, costs off)
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c);
+select 1 as a, 1 as b, 1+2 as c, (1+2)*10 as d
+group by rollup(a, c)
+order by a nulls first, c nulls first;
+
+-- likewise for an outer reference used as a grouping expression
+select array(select o.a as k from (values (1)) as i (x)
+ group by rollup(o.a, x+0) order by 1 nulls first)
+from (values (10)) as o (a);
+
explain (costs off)
select a, b, row_number() over (order by a, b nulls first)
from (values (1, 1), (2, 2)) as t (a, b) where a = b
--
2.53.0
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2026-10-28 16:43 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 18:20 BUG #19752: GROUP BY on a constant and a cast to a length-limited array type crashes the server while planning PG Bug reporting form <noreply@postgresql.org>
2026-10-08 19:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-10-08 19:48 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
2026-10-08 20:10 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-10-08 21:21 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
2026-10-12 17:54 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
2026-10-23 04:49 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
2026-10-23 15:34 ` Matheus Alcantara <matheusssilv97@gmail.com>
2026-10-26 09:16 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
2026-10-28 12:26 ` Matheus Alcantara <matheusssilv97@gmail.com>
2026-10-28 16:43 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox