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

Commit4c640f4

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 parent981dc2b commit4c640f4

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
@@ -2229,3 +2229,18 @@ SELECT dense_rank(x) WITHIN GROUP (ORDER BY x) FROM (VALUES (1),(1),(2),(2),(3),
22292229
1
22302230
(3 rows)
22312231

2232+
-- Ensure that the STRICT checks for aggregates does not take NULLness
2233+
-- of ORDER BY columns into account. See bug report around
2234+
-- 2a505161-2727-2473-7c46-591ed108ac52@email.cz
2235+
SELECT min(x ORDER BY y) FROM (VALUES(1, NULL)) AS d(x,y);
2236+
min
2237+
-----
2238+
1
2239+
(1 row)
2240+
2241+
SELECT min(x ORDER BY y) FROM (VALUES(1, 2)) AS d(x,y);
2242+
min
2243+
-----
2244+
1
2245+
(1 row)
2246+

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

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

970970
-- test coverage for dense_rank
971971
SELECT dense_rank(x) WITHIN GROUP (ORDER BY x)FROM (VALUES (1),(1),(2),(2),(3),(3)) v(x)GROUP BY (x)ORDER BY1;
972+
973+
974+
-- Ensure that the STRICT checks for aggregates does not take NULLness
975+
-- of ORDER BY columns into account. See bug report around
976+
-- 2a505161-2727-2473-7c46-591ed108ac52@email.cz
977+
SELECTmin(xORDER BY y)FROM (VALUES(1,NULL))AS d(x,y);
978+
SELECTmin(xORDER BY y)FROM (VALUES(1,2))AS d(x,y);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp