bool-minmax-optimization.patch
text/x-patch
Filename: bool-minmax-optimization.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/include/catalog/pg_aggregate.h | 3 | 3 |
| src/test/regress/expected/opr_sanity.out | 17 | 11 |
| src/test/regress/sql/opr_sanity.sql | 1 | 1 |
diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h
index 26966d2..29e262f 100644
--- a/src/include/catalog/pg_aggregate.h
+++ b/src/include/catalog/pg_aggregate.h
@@ -203,9 +203,9 @@ DATA(insert ( 2828 float8_regr_accum float8_covar_samp 0 1022 "{0,0,0,0,0,0}" )
DATA(insert ( 2829 float8_regr_accum float8_corr 0 1022 "{0,0,0,0,0,0}" ));
/* boolean-and and boolean-or */
-DATA(insert ( 2517 booland_statefunc - 0 16 _null_ ));
-DATA(insert ( 2518 boolor_statefunc - 0 16 _null_ ));
-DATA(insert ( 2519 booland_statefunc - 0 16 _null_ ));
+DATA(insert ( 2517 booland_statefunc - 58 16 _null_ ));
+DATA(insert ( 2518 boolor_statefunc - 59 16 _null_ ));
+DATA(insert ( 2519 booland_statefunc - 58 16 _null_ ));
/* bitwise integer */
DATA(insert ( 2236 int2and - 0 21 _null_ ));
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index 51ab6e5..7d245d2 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -774,16 +774,19 @@ WHERE a.aggfnoid = p.oid AND
(0 rows)
-- Cross-check aggsortop (if present) against pg_operator.
--- We expect to find only "<" for "min" and ">" for "max".
+-- We expect to find "<" for min/bool_and/every and ">" for max/bool_or
SELECT DISTINCT proname, oprname
FROM pg_operator AS o, pg_aggregate AS a, pg_proc AS p
WHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid
ORDER BY 1;
- proname | oprname
----------+---------
- max | >
- min | <
-(2 rows)
+ proname | oprname
+----------+---------
+ bool_and | <
+ bool_or | >
+ every | <
+ max | >
+ min | <
+(5 rows)
-- Check datatypes match
SELECT a.aggfnoid::oid, o.oid
@@ -816,11 +819,14 @@ WHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid AND
amopopr = o.oid AND
amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree')
ORDER BY 1, 2;
- proname | oprname | amopstrategy
----------+---------+--------------
- max | > | 5
- min | < | 1
-(2 rows)
+ proname | oprname | amopstrategy
+----------+---------+--------------
+ bool_and | < | 1
+ bool_or | > | 5
+ every | < | 1
+ max | > | 5
+ min | < | 1
+(5 rows)
-- Check that there are not aggregates with the same name and different
-- numbers of arguments. While not technically wrong, we have a project policy
diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql
index e29148f..bcd8544 100644
--- a/src/test/regress/sql/opr_sanity.sql
+++ b/src/test/regress/sql/opr_sanity.sql
@@ -626,7 +626,7 @@ WHERE a.aggfnoid = p.oid AND
NOT binary_coercible(p.proargtypes[0], a.aggtranstype);
-- Cross-check aggsortop (if present) against pg_operator.
--- We expect to find only "<" for "min" and ">" for "max".
+-- We expect to find "<" for min/bool_and/every and ">" for max/bool_or
SELECT DISTINCT proname, oprname
FROM pg_operator AS o, pg_aggregate AS a, pg_proc AS p