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

Commitba930a0

Browse files
committed
Add an opr_sanity check for misdefined aggregates that have transition
type different from input type but are expecting ExecAgg to insert thefirst non-null input as the starting transition value. This has alwaysbeen verboten, but wasn't checked for until now...
1 parent8b1b34f commitba930a0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,17 @@ WHERE p1.aggfinalfn = p2.oid AND
479479
-----+---------+-----+---------
480480
(0 rows)
481481

482+
-- If transfn is strict then either initval should be non-NULL, or
483+
-- basetype should equal transtype so that the first non-null input
484+
-- can be assigned as the state value.
485+
SELECT p1.oid, p1.aggname, p2.oid, p2.proname
486+
FROM pg_aggregate AS p1, pg_proc AS p2
487+
WHERE p1.aggtransfn = p2.oid AND p2.proisstrict AND
488+
p1.agginitval IS NULL AND p1.aggbasetype != p1.aggtranstype;
489+
oid | aggname | oid | proname
490+
-----+---------+-----+---------
491+
(0 rows)
492+
482493
-- **************** pg_opclass ****************
483494
-- There should not be multiple entries in pg_opclass with the same
484495
-- nonzero opcdeftype value, because there can be only one default opclass

‎src/test/regress/sql/opr_sanity.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,15 @@ WHERE p1.aggfinalfn = p2.oid AND
400400
p2.pronargs!=1OR
401401
p1.aggtranstype!=p2.proargtypes[0]);
402402

403+
-- If transfn is strict then either initval should be non-NULL, or
404+
-- basetype should equal transtype so that the first non-null input
405+
-- can be assigned as the state value.
406+
407+
SELECTp1.oid,p1.aggname,p2.oid,p2.proname
408+
FROM pg_aggregateAS p1, pg_procAS p2
409+
WHEREp1.aggtransfn=p2.oidANDp2.proisstrictAND
410+
p1.agginitval ISNULLANDp1.aggbasetype!=p1.aggtranstype;
411+
403412
-- **************** pg_opclass ****************
404413

405414
-- There should not be multiple entries in pg_opclass with the same

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp