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

Commita068b5b

Browse files
committed
Add opr_sanity queries to inspect commutator/negator links more closely.
Make lists of the names of all operators that are claimed to be commutatorpairs or negator pairs. This is analogous to the existing queries thatmake lists of all operator names appearing in particular opclass strategyslots. Unexpected additions to these lists are likely to be mistakes; hadwe had these queries in place before, bug #11178 might've been prevented.
1 parente3f9c16 commita068b5b

File tree

2 files changed

+90
-6
lines changed

2 files changed

+90
-6
lines changed

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

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
-- pg_operator, pg_proc, pg_cast, pg_aggregate, pg_am,
55
-- pg_amop, pg_amproc, pg_opclass, pg_opfamily.
66
--
7-
-- Every test failures in this file should be closely inspected. The
8-
-- description of the failing test should be read carefully before
9-
-- adjusting the expected output.
7+
-- Every test failure in this file should be closely inspected.
8+
-- The description of the failing test should be read carefully before
9+
-- adjusting the expected output. In most cases, the queries should
10+
-- not find *any* matching entries.
1011
--
1112
-- NB: we assume the oidjoins test will have caught any dangling links,
1213
-- that is OID or REGPROC fields that are not zero and do not match some
@@ -844,6 +845,72 @@ WHERE p1.oprnegate = p2.oid AND
844845
-----+---------+-----+---------
845846
(0 rows)
846847

848+
-- Make a list of the names of operators that are claimed to be commutator
849+
-- pairs. This list will grow over time, but before accepting a new entry
850+
-- make sure you didn't link the wrong operators.
851+
SELECT DISTINCT o1.oprname AS op1, o2.oprname AS op2
852+
FROM pg_operator o1, pg_operator o2
853+
WHERE o1.oprcom = o2.oid AND o1.oprname <= o2.oprname
854+
ORDER BY 1, 2;
855+
op1 | op2
856+
------+------
857+
# | #
858+
& | &
859+
&& | &&
860+
* | *
861+
*< | *>
862+
*<= | *>=
863+
*<> | *<>
864+
*= | *=
865+
+ | +
866+
-|- | -|-
867+
< | >
868+
<-> | <->
869+
<< | >>
870+
<<= | >>=
871+
<= | >=
872+
<> | <>
873+
<@ | @>
874+
= | =
875+
?# | ?#
876+
?- | ?-
877+
?-| | ?-|
878+
?| | ?|
879+
?|| | ?||
880+
@ | ~
881+
@@ | @@
882+
@@@ | @@@
883+
| | |
884+
~<=~ | ~>=~
885+
~<~ | ~>~
886+
~= | ~=
887+
(30 rows)
888+
889+
-- Likewise for negator pairs.
890+
SELECT DISTINCT o1.oprname AS op1, o2.oprname AS op2
891+
FROM pg_operator o1, pg_operator o2
892+
WHERE o1.oprnegate = o2.oid AND o1.oprname <= o2.oprname
893+
ORDER BY 1, 2;
894+
op1 | op2
895+
------+------
896+
!~ | ~
897+
!~* | ~*
898+
!~~ | ~~
899+
!~~* | ~~*
900+
#< | #>=
901+
#<= | #>
902+
#<> | #=
903+
*< | *>=
904+
*<= | *>
905+
*<> | *=
906+
< | >=
907+
<= | >
908+
<> | =
909+
<> | ~=
910+
~<=~ | ~>~
911+
~<~ | ~>=~
912+
(16 rows)
913+
847914
-- A mergejoinable or hashjoinable operator must be binary, must return
848915
-- boolean, and must have a commutator (itself, unless it's a cross-type
849916
-- operator).

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
-- pg_operator, pg_proc, pg_cast, pg_aggregate, pg_am,
55
-- pg_amop, pg_amproc, pg_opclass, pg_opfamily.
66
--
7-
-- Every test failures in this file should be closely inspected. The
8-
-- description of the failing test should be read carefully before
9-
-- adjusting the expected output.
7+
-- Every test failure in this file should be closely inspected.
8+
-- The description of the failing test should be read carefully before
9+
-- adjusting the expected output. In most cases, the queries should
10+
-- not find *any* matching entries.
1011
--
1112
-- NB: we assume the oidjoins test will have caught any dangling links,
1213
-- that is OID or REGPROC fields that are not zero and do not match some
@@ -481,6 +482,22 @@ WHERE p1.oprnegate = p2.oid AND
481482
p1.oid!=p2.oprnegateOR
482483
p1.oid=p2.oid);
483484

485+
-- Make a list of the names of operators that are claimed to be commutator
486+
-- pairs. This list will grow over time, but before accepting a new entry
487+
-- make sure you didn't link the wrong operators.
488+
489+
SELECT DISTINCTo1.oprnameAS op1,o2.oprnameAS op2
490+
FROM pg_operator o1, pg_operator o2
491+
WHEREo1.oprcom=o2.oidANDo1.oprname<=o2.oprname
492+
ORDER BY1,2;
493+
494+
-- Likewise for negator pairs.
495+
496+
SELECT DISTINCTo1.oprnameAS op1,o2.oprnameAS op2
497+
FROM pg_operator o1, pg_operator o2
498+
WHEREo1.oprnegate=o2.oidANDo1.oprname<=o2.oprname
499+
ORDER BY1,2;
500+
484501
-- A mergejoinable or hashjoinable operator must be binary, must return
485502
-- boolean, and must have a commutator (itself, unless it's a cross-type
486503
-- operator).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp