Skip to content

Commit 51f0f6d

Browse files
committed
Fix pg_operator entries for mergejoinable operators with different left and
right side data types. Correct the opr_sanity regress test to check these entries properly. NOTE that opr_sanity will now fail until you do an initdb!
1 parent dc77be0 commit 51f0f6d

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/include/catalog/pg_operator.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_operator.h,v 1.49 1999/02/13 23:21:11 momjian Exp $
10+
* $Id: pg_operator.h,v 1.50 1999/02/28 00:56:40 tgl Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -88,7 +88,7 @@ typedef FormData_pg_operator *Form_pg_operator;
8888
* ----------------
8989
*/
9090

91-
DATA(insert OID = 15 ( "=" PGUID 0 b t t 23 20 16 416 36 37 37 int48eq eqsel eqjoinsel ));
91+
DATA(insert OID = 15 ( "=" PGUID 0 b t t 23 20 16 416 36 97 412 int48eq eqsel eqjoinsel ));
9292
DATA(insert OID = 36 ( "<>" PGUID 0 b t t 23 20 16 417 15 0 0 int48ne neqsel neqjoinsel ));
9393
DATA(insert OID = 37 ( "<" PGUID 0 b t f 23 20 16 419 82 0 0 int48lt intltsel intltjoinsel ));
9494
DATA(insert OID = 76 ( ">" PGUID 0 b t f 23 20 16 418 80 0 0 int48gt intgtsel intgtjoinsel ));
@@ -148,7 +148,7 @@ DATA(insert OID = 413 ( ">" PGUID 0 b t f 20 20 16 412 414 0 0 int8gt int
148148
DATA(insert OID = 414 ( "<=" PGUID 0 b t f 20 20 16 415 413 0 0 int8le intlesel intlejoinsel ));
149149
DATA(insert OID = 415 ( ">=" PGUID 0 b t f 20 20 16 414 412 0 0 int8ge intgesel intgejoinsel ));
150150

151-
DATA(insert OID = 416 ( "=" PGUID 0 b t t 20 23 16 15 417 418 418 int84eq eqsel eqjoinsel ));
151+
DATA(insert OID = 416 ( "=" PGUID 0 b t t 20 23 16 15 417 412 97 int84eq eqsel eqjoinsel ));
152152
DATA(insert OID = 417 ( "<>" PGUID 0 b t t 20 23 16 36 416 0 0 int84ne neqsel neqjoinsel ));
153153
DATA(insert OID = 418 ( "<" PGUID 0 b t f 20 23 16 76 430 0 0 int84lt intltsel intltjoinsel ));
154154
DATA(insert OID = 419 ( ">" PGUID 0 b t f 20 23 16 37 420 0 0 int84gt intgtsel intgtjoinsel ));
@@ -203,8 +203,8 @@ DATA(insert OID = 528 ( "/" PGUID 0 b t f 23 23 23 0 0 0 0 int4div
203203
DATA(insert OID = 529 ( "%" PGUID 0 b t f 21 21 21 0 0 0 0 int2mod intltsel intltjoinsel ));
204204
DATA(insert OID = 530 ( "%" PGUID 0 b t f 23 23 23 0 0 0 0 int4mod intltsel intltjoinsel ));
205205
DATA(insert OID = 531 ( "<>" PGUID 0 b t f 25 25 16 531 98 0 0 textne neqsel neqjoinsel ));
206-
DATA(insert OID = 532 ( "=" PGUID 0 b t t 21 23 16 533 538 534 534 int24eq eqsel eqjoinsel ));
207-
DATA(insert OID = 533 ( "=" PGUID 0 b t t 23 21 16 532 539 535 535 int42eq eqsel eqjoinsel ));
206+
DATA(insert OID = 532 ( "=" PGUID 0 b t t 21 23 16 533 538 95 97 int24eq eqsel eqjoinsel ));
207+
DATA(insert OID = 533 ( "=" PGUID 0 b t t 23 21 16 532 539 97 95 int42eq eqsel eqjoinsel ));
208208
DATA(insert OID = 534 ( "<" PGUID 0 b t f 21 23 16 537 542 0 0 int24lt intltsel intltjoinsel ));
209209
DATA(insert OID = 535 ( "<" PGUID 0 b t f 23 21 16 536 543 0 0 int42lt intltsel intltjoinsel ));
210210
DATA(insert OID = 536 ( ">" PGUID 0 b t f 21 23 16 535 540 0 0 int24gt intgtsel intgtjoinsel ));
@@ -481,7 +481,7 @@ DATA(insert OID = 1116 ( "+" PGUID 0 b t f 700 701 701 1126 0 0 0 float48pl
481481
DATA(insert OID = 1117 ( "-" PGUID 0 b t f 700 701 701 0 0 0 0 float48mi - - ));
482482
DATA(insert OID = 1118 ( "/" PGUID 0 b t f 700 701 701 0 0 0 0 float48div - - ));
483483
DATA(insert OID = 1119 ( "*" PGUID 0 b t f 700 701 701 1129 0 0 0 float48mul - - ));
484-
DATA(insert OID = 1120 ( "=" PGUID 0 b t t 700 701 16 1130 1121 1122 1122 float48eq eqsel eqjoinsel ));
484+
DATA(insert OID = 1120 ( "=" PGUID 0 b t t 700 701 16 1130 1121 622 672 float48eq eqsel eqjoinsel ));
485485
DATA(insert OID = 1121 ( "<>" PGUID 0 b t f 700 701 16 1131 1120 0 0 float48ne neqsel neqjoinsel ));
486486
DATA(insert OID = 1122 ( "<" PGUID 0 b t f 700 701 16 1133 1125 0 0 float48lt intltsel intltjoinsel ));
487487
DATA(insert OID = 1123 ( ">" PGUID 0 b t f 700 701 16 1132 1124 0 0 float48gt intgtsel intgtjoinsel ));
@@ -493,7 +493,7 @@ DATA(insert OID = 1126 ( "+" PGUID 0 b t f 701 700 701 1116 0 0 0 float84pl
493493
DATA(insert OID = 1127 ( "-" PGUID 0 b t f 701 700 701 0 0 0 0 float84mi - - ));
494494
DATA(insert OID = 1128 ( "/" PGUID 0 b t f 701 700 701 0 0 0 0 float84div - - ));
495495
DATA(insert OID = 1129 ( "*" PGUID 0 b t f 701 700 701 1119 0 0 0 float84mul - - ));
496-
DATA(insert OID = 1130 ( "=" PGUID 0 b t t 701 700 16 1120 1131 1132 1132 float84eq eqsel eqjoinsel ));
496+
DATA(insert OID = 1130 ( "=" PGUID 0 b t t 701 700 16 1120 1131 672 622 float84eq eqsel eqjoinsel ));
497497
DATA(insert OID = 1131 ( "<>" PGUID 0 b t f 701 700 16 1121 1130 0 0 float84ne neqsel neqjoinsel ));
498498
DATA(insert OID = 1132 ( "<" PGUID 0 b t f 701 700 16 1123 1135 0 0 float84lt intltsel intltjoinsel ));
499499
DATA(insert OID = 1133 ( ">" PGUID 0 b t f 701 700 16 1122 1134 0 0 float84gt intgtsel intgtjoinsel ));

src/test/regress/expected/opr_sanity.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ oid|oprcode|oid|oprcode
8383
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
8484
FROM pg_operator AS p1, pg_operator AS p2
8585
WHERE p1.oprlsortop = p2.oid AND
86-
(p1.oprname != '=' OR
86+
(p1.oprname != '=' OR p2.oprname != '<' OR
8787
p1.oprkind != 'b' OR p2.oprkind != 'b' OR
8888
p1.oprleft != p2.oprleft OR
89-
p1.oprright != p2.oprright OR
89+
p1.oprleft != p2.oprright OR
9090
p1.oprresult != 16 OR
9191
p2.oprresult != 16 OR
9292
p1.oprrsortop = 0);
@@ -97,9 +97,9 @@ oid|oprcode|oid|oprcode
9797
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
9898
FROM pg_operator AS p1, pg_operator AS p2
9999
WHERE p1.oprrsortop = p2.oid AND
100-
(p1.oprname != '=' OR
100+
(p1.oprname != '=' OR p2.oprname != '<' OR
101101
p1.oprkind != 'b' OR p2.oprkind != 'b' OR
102-
p1.oprleft != p2.oprleft OR
102+
p1.oprright != p2.oprleft OR
103103
p1.oprright != p2.oprright OR
104104
p1.oprresult != 16 OR
105105
p2.oprresult != 16 OR

src/test/regress/sql/opr_sanity.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,28 @@ WHERE p1.oprnegate = p2.oid AND
8181
p2.oprresult != 16 OR
8282
p1.oid != p2.oprnegate);
8383

84-
-- Look for sort operators that don't match.
85-
-- A sort link normally leads from an '='
86-
-- operator to the matching '<' operator.
87-
-- Sort links are not commutative.
84+
-- Look for mergesort operators that don't match.
85+
-- A mergesort link leads from an '=' operator to the
86+
-- sort operator ('<' operator) that's appropriate for
87+
-- its left-side or right-side data type.
8888

8989
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
9090
FROM pg_operator AS p1, pg_operator AS p2
9191
WHERE p1.oprlsortop = p2.oid AND
92-
(p1.oprname != '=' OR
92+
(p1.oprname != '=' OR p2.oprname != '<' OR
9393
p1.oprkind != 'b' OR p2.oprkind != 'b' OR
9494
p1.oprleft != p2.oprleft OR
95-
p1.oprright != p2.oprright OR
95+
p1.oprleft != p2.oprright OR
9696
p1.oprresult != 16 OR
9797
p2.oprresult != 16 OR
9898
p1.oprrsortop = 0);
9999

100100
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
101101
FROM pg_operator AS p1, pg_operator AS p2
102102
WHERE p1.oprrsortop = p2.oid AND
103-
(p1.oprname != '=' OR
103+
(p1.oprname != '=' OR p2.oprname != '<' OR
104104
p1.oprkind != 'b' OR p2.oprkind != 'b' OR
105-
p1.oprleft != p2.oprleft OR
105+
p1.oprright != p2.oprleft OR
106106
p1.oprright != p2.oprright OR
107107
p1.oprresult != 16 OR
108108
p2.oprresult != 16 OR

0 commit comments

Comments
 (0)