Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd59b29

Browse files
committed
Fix STRICT check for strict aggregates with NULL ORDER BY columns.
I (Andres) broke this unintentionally in69c3936, by checkingstrictness for all input expressions computed for an aggregate, ratherthan just the input for the aggregate transition function.Reported-By: Ondřej BoudaBisected-By: Tom LaneDiagnosed-By: Andrew GierthDiscussion:https://postgr.es/m/2a505161-2727-2473-7c46-591ed108ac52@email.czBackpatch: 11-, like69c3936
1 parentbf4a956 commitfd59b29

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

‎src/backend/executor/execExpr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3028,7 +3028,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
30283028
scratch.opcode=EEOP_AGG_STRICT_INPUT_CHECK;
30293029
scratch.d.agg_strict_input_check.nulls=strictnulls;
30303030
scratch.d.agg_strict_input_check.jumpnull=-1;/* adjust later */
3031-
scratch.d.agg_strict_input_check.nargs=numInputs;
3031+
scratch.d.agg_strict_input_check.nargs=pertrans->numTransInputs;
30323032
ExprEvalPushStep(state,&scratch);
30333033
adjust_bailout=lappend_int(adjust_bailout,
30343034
state->steps_len-1);

‎src/test/regress/expected/aggregates.out

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,3 +2101,18 @@ SELECT dense_rank(x) WITHIN GROUP (ORDER BY x) FROM (VALUES (1),(1),(2),(2),(3),
21012101
1
21022102
(3 rows)
21032103

2104+
-- Ensure that the STRICT checks for aggregates does not take NULLness
2105+
-- of ORDER BY columns into account. See bug report around
2106+
-- 2a505161-2727-2473-7c46-591ed108ac52@email.cz
2107+
SELECT min(x ORDER BY y) FROM (VALUES(1, NULL)) AS d(x,y);
2108+
min
2109+
-----
2110+
1
2111+
(1 row)
2112+
2113+
SELECT min(x ORDER BY y) FROM (VALUES(1, 2)) AS d(x,y);
2114+
min
2115+
-----
2116+
1
2117+
(1 row)
2118+

‎src/test/regress/sql/aggregates.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,3 +928,10 @@ ROLLBACK;
928928

929929
-- test coverage for dense_rank
930930
SELECT dense_rank(x) WITHIN GROUP (ORDER BY x)FROM (VALUES (1),(1),(2),(2),(3),(3)) v(x)GROUP BY (x)ORDER BY1;
931+
932+
933+
-- Ensure that the STRICT checks for aggregates does not take NULLness
934+
-- of ORDER BY columns into account. See bug report around
935+
-- 2a505161-2727-2473-7c46-591ed108ac52@email.cz
936+
SELECTmin(xORDER BY y)FROM (VALUES(1,NULL))AS d(x,y);
937+
SELECTmin(xORDER BY y)FROM (VALUES(1,2))AS d(x,y);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp