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

Commit4e21023

Browse files
committed
Unmark 'hashable' operators that can't really be used for
hashjoins. Extend opr_sanity regress test to help detect similar mistakes.
1 parent7fcbc5d commit4e21023

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

‎src/include/catalog/pg_operator.h

Lines changed: 11 additions & 11 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.53 1999/03/28 02:01:38 tgl Exp $
10+
* $Id: pg_operator.h,v 1.54 1999/04/07 04:21:10 tgl Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -88,8 +88,8 @@ typedef FormData_pg_operator *Form_pg_operator;
8888
* ----------------
8989
*/
9090

91-
DATA(insertOID=15 ("="PGUID0btt2320164163697412int48eqeqseleqjoinsel ));
92-
DATA(insertOID=36 ("<>"PGUID0btt2320164171500int48neneqselneqjoinsel ));
91+
DATA(insertOID=15 ("="PGUID0btf2320164163697412int48eqeqseleqjoinsel ));
92+
DATA(insertOID=36 ("<>"PGUID0btf2320164171500int48neneqselneqjoinsel ));
9393
DATA(insertOID=37 ("<"PGUID0btf2320164198200int48ltintltselintltjoinsel ));
9494
DATA(insertOID=76 (">"PGUID0btf2320164188000int48gtintgtselintgtjoinsel ));
9595
DATA(insertOID=80 ("<="PGUID0btf2320164307600int48leintleselintlejoinsel ));
@@ -137,14 +137,14 @@ DATA(insert OID = 400 ( "=" PGUID 0 b t t 10271027 16 400 0 00 array_e
137137
DATA(insertOID=401 ("="PGUID0btt1034103416401000array_eqeqseleqjoinsel ));
138138

139139
DATA(insertOID=410 ("="PGUID0btt202016410411412412int8eqeqseleqjoinsel ));
140-
DATA(insertOID=411 ("<>"PGUID0btt20201641141000int8neneqselneqjoinsel ));
140+
DATA(insertOID=411 ("<>"PGUID0btf20201641141000int8neneqselneqjoinsel ));
141141
DATA(insertOID=412 ("<"PGUID0btf20201641341500int8ltintltselintltjoinsel ));
142142
DATA(insertOID=413 (">"PGUID0btf20201641241400int8gtintgtselintgtjoinsel ));
143143
DATA(insertOID=414 ("<="PGUID0btf20201641541300int8leintleselintlejoinsel ));
144144
DATA(insertOID=415 (">="PGUID0btf20201641441200int8geintgeselintgejoinsel ));
145145

146-
DATA(insertOID=416 ("="PGUID0btt2023161541741297int84eqeqseleqjoinsel ));
147-
DATA(insertOID=417 ("<>"PGUID0btt2023163641600int84neneqselneqjoinsel ));
146+
DATA(insertOID=416 ("="PGUID0btf2023161541741297int84eqeqseleqjoinsel ));
147+
DATA(insertOID=417 ("<>"PGUID0btf2023163641600int84neneqselneqjoinsel ));
148148
DATA(insertOID=418 ("<"PGUID0btf2023167643000int84ltintltselintltjoinsel ));
149149
DATA(insertOID=419 (">"PGUID0btf2023163742000int84gtintgtselintgtjoinsel ));
150150
DATA(insertOID=420 ("<="PGUID0btf2023168241900int84leintleselintlejoinsel ));
@@ -198,8 +198,8 @@ DATA(insert OID = 528 ( "/" PGUID 0 b t f 23 23 23 0 0 0 0 int4div
198198
DATA(insertOID=529 ("%"PGUID0btf2121210000int2mod-- ));
199199
DATA(insertOID=530 ("%"PGUID0btf2323230000int4mod-- ));
200200
DATA(insertOID=531 ("<>"PGUID0btf2525165319800textneneqselneqjoinsel ));
201-
DATA(insertOID=532 ("="PGUID0btt2123165335389597int24eqeqseleqjoinsel ));
202-
DATA(insertOID=533 ("="PGUID0btt2321165325399795int42eqeqseleqjoinsel ));
201+
DATA(insertOID=532 ("="PGUID0btf2123165335389597int24eqeqseleqjoinsel ));
202+
DATA(insertOID=533 ("="PGUID0btf2321165325399795int42eqeqseleqjoinsel ));
203203
DATA(insertOID=534 ("<"PGUID0btf21231653754200int24ltintltselintltjoinsel ));
204204
DATA(insertOID=535 ("<"PGUID0btf23211653654300int42ltintltselintltjoinsel ));
205205
DATA(insertOID=536 (">"PGUID0btf21231653554000int24gtintgtselintgtjoinsel ));
@@ -238,7 +238,7 @@ DATA(insert OID = 568 ( "<" PGUID 0 b t f 703 703 16 569 571 0 0 reltimelt
238238
DATA(insertOID=569 (">"PGUID0btf7037031656857000reltimegt-- ));
239239
DATA(insertOID=570 ("<="PGUID0btf7037031657156900reltimele-- ));
240240
DATA(insertOID=571 (">="PGUID0btf7037031657056800reltimege-- ));
241-
DATA(insertOID=572 ("~="PGUID0btt70470416572000intervalsame-- ));
241+
DATA(insertOID=572 ("~="PGUID0btf70470416572000intervalsame-- ));
242242
DATA(insertOID=573 ("<<"PGUID0btf704704160000intervalct-- ));
243243
DATA(insertOID=574 ("&&"PGUID0btf704704160000intervalov-- ));
244244
DATA(insertOID=575 ("#="PGUID0btf70470316057600intervalleneq-- ));
@@ -476,7 +476,7 @@ DATA(insert OID = 1116 ( "+"PGUID 0 b t f 700 701 701 1126 0 0 0 float48pl
476476
DATA(insertOID=1117 ("-"PGUID0btf7007017010000float48mi-- ));
477477
DATA(insertOID=1118 ("/"PGUID0btf7007017010000float48div-- ));
478478
DATA(insertOID=1119 ("*"PGUID0btf7007017011129000float48mul-- ));
479-
DATA(insertOID=1120 ("="PGUID0btt7007011611301121622672float48eqeqseleqjoinsel ));
479+
DATA(insertOID=1120 ("="PGUID0btf7007011611301121622672float48eqeqseleqjoinsel ));
480480
DATA(insertOID=1121 ("<>"PGUID0btf700701161131112000float48neneqselneqjoinsel ));
481481
DATA(insertOID=1122 ("<"PGUID0btf700701161133112500float48ltintltselintltjoinsel ));
482482
DATA(insertOID=1123 (">"PGUID0btf700701161132112400float48gtintgtselintgtjoinsel ));
@@ -488,7 +488,7 @@ DATA(insert OID = 1126 ( "+"PGUID 0 b t f 701 700 701 1116 0 0 0 float84pl
488488
DATA(insertOID=1127 ("-"PGUID0btf7017007010000float84mi-- ));
489489
DATA(insertOID=1128 ("/"PGUID0btf7017007010000float84div-- ));
490490
DATA(insertOID=1129 ("*"PGUID0btf7017007011119000float84mul-- ));
491-
DATA(insertOID=1130 ("="PGUID0btt7017001611201131672622float84eqeqseleqjoinsel ));
491+
DATA(insertOID=1130 ("="PGUID0btf7017001611201131672622float84eqeqseleqjoinsel ));
492492
DATA(insertOID=1131 ("<>"PGUID0btf701700161121113000float84neneqselneqjoinsel ));
493493
DATA(insertOID=1132 ("<"PGUID0btf701700161123113500float84ltintltselintltjoinsel ));
494494
DATA(insertOID=1133 (">"PGUID0btf701700161122113400float84gtintgtselintgtjoinsel ));

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,13 @@ oid|oprname
135135
QUERY: SELECT p1.oid, p1.oprname
136136
FROM pg_operator as p1
137137
WHERE p1.oprcanhash AND NOT
138-
(p1.oprkind = 'b' AND p1.oprresult = 16 AND p1.oprcom != 0);
139-
oid|oprname
140-
---+-------
141-
(0 rows)
138+
(p1.oprkind = 'b' AND p1.oprresult = 16 AND p1.oprleft = p1.oprright AND
139+
p1.oprname = '=' AND p1.oprcom = p1.oid);
140+
oid|oprname
141+
----+-------
142+
1136|=
143+
1137|=
144+
(2 rows)
142145

143146
QUERY: SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode
144147
FROM pg_operator AS p1, pg_operator AS p2

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,15 @@ WHERE (p1.oprleft = 0 and p1.oprkind != 'l') OR
132132
(p1.oprright=0andp1.oprkind!='r')OR
133133
(p1.oprright!=0andp1.oprkind='r');
134134

135-
-- Hash operators should be commutative binary ops returning bool.
135+
-- Hashing only works on simple equality operators "type = sametype",
136+
-- since the hash itself depends on the bitwise representation of the type.
137+
-- Check that allegedly hashable operators look like they might be "=".
136138

137139
SELECTp1.oid,p1.oprname
138140
FROM pg_operatoras p1
139141
WHEREp1.oprcanhashAND NOT
140-
(p1.oprkind='b'ANDp1.oprresult=16ANDp1.oprcom!=0);
142+
(p1.oprkind='b'ANDp1.oprresult=16ANDp1.oprleft=p1.oprrightAND
143+
p1.oprname='='ANDp1.oprcom=p1.oid);
141144

142145
-- Look for conflicting operator definitions (same names and input datatypes).
143146

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp