01.10.2019 8:41, Antonin Houska wrote:
Anastasia Lubennikova <a.lubennik...@postgrespro.ru> wrote:
The patch implementing new opclass option is attached.
It adds new attribute pg_opclass.opcisbitwise, which is set to true if opclass
equality is the same as binary equality.
By default it is true.
I think the default value should be false and we should only set it to true
for individual opclasses which do meet the bitwise equality requirement. Also
extension authors should explicitly state that their data types are bitwise
equal. Otherwise the existing opclasses, when created via pg_dump ->
pg_restore, can be used by the system incorrectly.
Thank you for the feedback.
At first I implemented bitwise as default, because it is more common .
Though, I agree that it's essential to avoid false positives here.
The new version of the patch is attached. I also updated pg_dump.
A few more open questions:
1) How to handle contrib modules that create new opclasses?
Since default is 'not bitwise' it means that various operator classes
created in extensions
such as bloom, btree_gin and others, won't be able to take advantage of
various optimizations
that require the opclass to be BITWISE.
'v2-Opclass-bitwise-equality-0002' patch simply adds BITWISE keyword
where necessary.
2) Whether we should provide ALTER OPERATOR CLASS SET BITWISE syntax?
3) Current patch modifies regression test so that it checks CREATE
OPCLASS BITWISE syntax.
Is there anything else worth testing? As I see it, this patch is just
about infrastructure changes,
and more specific tests will be added by features that will implement
further optimizations.
--
Anastasia Lubennikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
diff --git a/contrib/bloom/bloom--1.0.sql b/contrib/bloom/bloom--1.0.sql
index 4e7c922..ca54f81 100644
--- a/contrib/bloom/bloom--1.0.sql
+++ b/contrib/bloom/bloom--1.0.sql
@@ -15,11 +15,11 @@ COMMENT ON ACCESS METHOD bloom IS 'bloom index access method';
-- Opclasses
CREATE OPERATOR CLASS int4_ops
-DEFAULT FOR TYPE int4 USING bloom AS
+DEFAULT BITWISE FOR TYPE int4 USING bloom AS
OPERATOR 1 =(int4, int4),
FUNCTION 1 hashint4(int4);
CREATE OPERATOR CLASS text_ops
-DEFAULT FOR TYPE text USING bloom AS
+DEFAULT BITWISE FOR TYPE text USING bloom AS
OPERATOR 1 =(text, text),
FUNCTION 1 hashtext(text);
diff --git a/contrib/btree_gin/btree_gin--1.0--1.1.sql b/contrib/btree_gin/btree_gin--1.0--1.1.sql
index dd81d27..b6f01cb 100644
--- a/contrib/btree_gin/btree_gin--1.0--1.1.sql
+++ b/contrib/btree_gin/btree_gin--1.0--1.1.sql
@@ -20,7 +20,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS macaddr8_ops
-DEFAULT FOR TYPE macaddr8 USING gin
+DEFAULT BITWISE FOR TYPE macaddr8 USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
diff --git a/contrib/btree_gin/btree_gin--1.0.sql b/contrib/btree_gin/btree_gin--1.0.sql
index cf867ef..473d395 100644
--- a/contrib/btree_gin/btree_gin--1.0.sql
+++ b/contrib/btree_gin/btree_gin--1.0.sql
@@ -24,7 +24,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS int2_ops
-DEFAULT FOR TYPE int2 USING gin
+DEFAULT BITWISE FOR TYPE int2 USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -54,7 +54,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS int4_ops
-DEFAULT FOR TYPE int4 USING gin
+DEFAULT BITWISE FOR TYPE int4 USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -84,7 +84,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS int8_ops
-DEFAULT FOR TYPE int8 USING gin
+DEFAULT BITWISE FOR TYPE int8 USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -114,7 +114,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS float4_ops
-DEFAULT FOR TYPE float4 USING gin
+DEFAULT BITWISE FOR TYPE float4 USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -174,7 +174,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS money_ops
-DEFAULT FOR TYPE money USING gin
+DEFAULT BITWISE FOR TYPE money USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -204,7 +204,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS oid_ops
-DEFAULT FOR TYPE oid USING gin
+DEFAULT BITWISE FOR TYPE oid USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -234,7 +234,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS timestamp_ops
-DEFAULT FOR TYPE timestamp USING gin
+DEFAULT BITWISE FOR TYPE timestamp USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -264,7 +264,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS timestamptz_ops
-DEFAULT FOR TYPE timestamptz USING gin
+DEFAULT BITWISE FOR TYPE timestamptz USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -294,7 +294,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS time_ops
-DEFAULT FOR TYPE time USING gin
+DEFAULT BITWISE FOR TYPE time USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -324,7 +324,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS timetz_ops
-DEFAULT FOR TYPE timetz USING gin
+DEFAULT BITWISE FOR TYPE timetz USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -354,7 +354,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS date_ops
-DEFAULT FOR TYPE date USING gin
+DEFAULT BITWISE FOR TYPE date USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -384,7 +384,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS interval_ops
-DEFAULT FOR TYPE interval USING gin
+DEFAULT BITWISE FOR TYPE interval USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -414,7 +414,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS macaddr_ops
-DEFAULT FOR TYPE macaddr USING gin
+DEFAULT BITWISE FOR TYPE macaddr USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -444,7 +444,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS inet_ops
-DEFAULT FOR TYPE inet USING gin
+DEFAULT BITWISE FOR TYPE inet USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -474,7 +474,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS cidr_ops
-DEFAULT FOR TYPE cidr USING gin
+DEFAULT BITWISE FOR TYPE cidr USING gin
AS
OPERATOR 1 <(inet,inet),
OPERATOR 2 <=(inet,inet),
@@ -504,7 +504,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS text_ops
-DEFAULT FOR TYPE text USING gin
+DEFAULT BITWISE FOR TYPE text USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -519,7 +519,7 @@ AS
STORAGE text;
CREATE OPERATOR CLASS varchar_ops
-DEFAULT FOR TYPE varchar USING gin
+DEFAULT BITWISE FOR TYPE varchar USING gin
AS
OPERATOR 1 <(text,text),
OPERATOR 2 <=(text,text),
@@ -549,7 +549,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS char_ops
-DEFAULT FOR TYPE "char" USING gin
+DEFAULT BITWISE FOR TYPE "char" USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -579,7 +579,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS bytea_ops
-DEFAULT FOR TYPE bytea USING gin
+DEFAULT BITWISE FOR TYPE bytea USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -609,7 +609,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS bit_ops
-DEFAULT FOR TYPE bit USING gin
+DEFAULT BITWISE FOR TYPE bit USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -639,7 +639,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS varbit_ops
-DEFAULT FOR TYPE varbit USING gin
+DEFAULT BITWISE FOR TYPE varbit USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
diff --git a/contrib/btree_gin/btree_gin--1.1--1.2.sql b/contrib/btree_gin/btree_gin--1.1--1.2.sql
index 2a16837..f8bd1b4 100644
--- a/contrib/btree_gin/btree_gin--1.1--1.2.sql
+++ b/contrib/btree_gin/btree_gin--1.1--1.2.sql
@@ -32,7 +32,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS enum_ops
-DEFAULT FOR TYPE anyenum USING gin
+DEFAULT BITWISE FOR TYPE anyenum USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
diff --git a/contrib/btree_gin/btree_gin--1.2--1.3.sql b/contrib/btree_gin/btree_gin--1.2--1.3.sql
index db675b7..1c5d538 100644
--- a/contrib/btree_gin/btree_gin--1.2--1.3.sql
+++ b/contrib/btree_gin/btree_gin--1.2--1.3.sql
@@ -20,7 +20,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS uuid_ops
-DEFAULT FOR TYPE uuid USING gin
+DEFAULT BITWISE FOR TYPE uuid USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -51,7 +51,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS name_ops
-DEFAULT FOR TYPE name USING gin
+DEFAULT BITWISE FOR TYPE name USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -82,7 +82,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS bool_ops
-DEFAULT FOR TYPE bool USING gin
+DEFAULT BITWISE FOR TYPE bool USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -113,7 +113,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE;
CREATE OPERATOR CLASS bpchar_ops
-DEFAULT FOR TYPE bpchar USING gin
+DEFAULT BITWISE FOR TYPE bpchar USING gin
AS
OPERATOR 1 <,
OPERATOR 2 <=,
diff --git a/contrib/btree_gist/btree_gist--1.2--1.3.sql b/contrib/btree_gist/btree_gist--1.2--1.3.sql
index 726561e..552339c 100644
--- a/contrib/btree_gist/btree_gist--1.2--1.3.sql
+++ b/contrib/btree_gist/btree_gist--1.2--1.3.sql
@@ -43,7 +43,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_uuid_ops
-DEFAULT FOR TYPE uuid USING gist
+DEFAULT BITWISE FOR TYPE uuid USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
diff --git a/contrib/btree_gist/btree_gist--1.2.sql b/contrib/btree_gist/btree_gist--1.2.sql
index 1efe753..8a705b0 100644
--- a/contrib/btree_gist/btree_gist--1.2.sql
+++ b/contrib/btree_gist/btree_gist--1.2.sql
@@ -296,7 +296,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_oid_ops
-DEFAULT FOR TYPE oid USING gist
+DEFAULT BITWISE FOR TYPE oid USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -373,7 +373,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_int2_ops
-DEFAULT FOR TYPE int2 USING gist
+DEFAULT BITWISE FOR TYPE int2 USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -445,7 +445,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_int4_ops
-DEFAULT FOR TYPE int4 USING gist
+DEFAULT BITWISE FOR TYPE int4 USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -518,7 +518,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_int8_ops
-DEFAULT FOR TYPE int8 USING gist
+DEFAULT BITWISE FOR TYPE int8 USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -749,7 +749,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_timestamp_ops
-DEFAULT FOR TYPE timestamp USING gist
+DEFAULT BITWISE FOR TYPE timestamp USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -773,7 +773,7 @@ ALTER OPERATOR FAMILY gist_timestamp_ops USING gist ADD
-- Create the operator class
CREATE OPERATOR CLASS gist_timestamptz_ops
-DEFAULT FOR TYPE timestamptz USING gist
+DEFAULT BITWISE FOR TYPE timestamptz USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -855,7 +855,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_time_ops
-DEFAULT FOR TYPE time USING gist
+DEFAULT BITWISE FOR TYPE time USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -879,7 +879,7 @@ ALTER OPERATOR FAMILY gist_time_ops USING gist ADD
CREATE OPERATOR CLASS gist_timetz_ops
-DEFAULT FOR TYPE timetz USING gist
+DEFAULT BITWISE FOR TYPE timetz USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -950,7 +950,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_date_ops
-DEFAULT FOR TYPE date USING gist
+DEFAULT BITWISE FOR TYPE date USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1028,7 +1028,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_interval_ops
-DEFAULT FOR TYPE interval USING gist
+DEFAULT BITWISE FOR TYPE interval USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1101,7 +1101,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_cash_ops
-DEFAULT FOR TYPE money USING gist
+DEFAULT BITWISE FOR TYPE money USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1169,7 +1169,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_macaddr_ops
-DEFAULT FOR TYPE macaddr USING gist
+DEFAULT BITWISE FOR TYPE macaddr USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1240,7 +1240,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_text_ops
-DEFAULT FOR TYPE text USING gist
+DEFAULT BITWISE FOR TYPE text USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1263,7 +1263,7 @@ ALTER OPERATOR FAMILY gist_text_ops USING gist ADD
---- Create the operator class
CREATE OPERATOR CLASS gist_bpchar_ops
-DEFAULT FOR TYPE bpchar USING gist
+DEFAULT BITWISE FOR TYPE bpchar USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1322,7 +1322,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_bytea_ops
-DEFAULT FOR TYPE bytea USING gist
+DEFAULT BITWISE FOR TYPE bytea USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1443,7 +1443,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_bit_ops
-DEFAULT FOR TYPE bit USING gist
+DEFAULT BITWISE FOR TYPE bit USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1466,7 +1466,7 @@ ALTER OPERATOR FAMILY gist_bit_ops USING gist ADD
-- Create the operator class
CREATE OPERATOR CLASS gist_vbit_ops
-DEFAULT FOR TYPE varbit USING gist
+DEFAULT BITWISE FOR TYPE varbit USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1527,7 +1527,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_inet_ops
-DEFAULT FOR TYPE inet USING gist
+DEFAULT BITWISE FOR TYPE inet USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
@@ -1549,7 +1549,7 @@ ALTER OPERATOR FAMILY gist_inet_ops USING gist ADD
-- Create the operator class
CREATE OPERATOR CLASS gist_cidr_ops
-DEFAULT FOR TYPE cidr USING gist
+DEFAULT BITWISE FOR TYPE cidr USING gist
AS
OPERATOR 1 < (inet, inet) ,
OPERATOR 2 <= (inet, inet) ,
diff --git a/contrib/btree_gist/btree_gist--1.3--1.4.sql b/contrib/btree_gist/btree_gist--1.3--1.4.sql
index f77f6c8..557701a 100644
--- a/contrib/btree_gist/btree_gist--1.3--1.4.sql
+++ b/contrib/btree_gist/btree_gist--1.3--1.4.sql
@@ -43,7 +43,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_macaddr8_ops
-DEFAULT FOR TYPE macaddr8 USING gist
+DEFAULT BITWISE FOR TYPE macaddr8 USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
diff --git a/contrib/btree_gist/btree_gist--1.4--1.5.sql b/contrib/btree_gist/btree_gist--1.4--1.5.sql
index cf974c2..14ef593 100644
--- a/contrib/btree_gist/btree_gist--1.4--1.5.sql
+++ b/contrib/btree_gist/btree_gist--1.4--1.5.sql
@@ -48,7 +48,7 @@ LANGUAGE C IMMUTABLE STRICT;
-- Create the operator class
CREATE OPERATOR CLASS gist_enum_ops
-DEFAULT FOR TYPE anyenum USING gist
+DEFAULT BITWISE FOR TYPE anyenum USING gist
AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
diff --git a/contrib/citext/citext--1.4--1.5.sql b/contrib/citext/citext--1.4--1.5.sql
index 5ae522b..6a3369e 100644
--- a/contrib/citext/citext--1.4--1.5.sql
+++ b/contrib/citext/citext--1.4--1.5.sql
@@ -79,7 +79,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
CREATE OPERATOR CLASS citext_pattern_ops
-FOR TYPE CITEXT USING btree AS
+BITWISE FOR TYPE CITEXT USING btree AS
OPERATOR 1 ~<~ (citext, citext),
OPERATOR 2 ~<=~ (citext, citext),
OPERATOR 3 = (citext, citext),
diff --git a/contrib/citext/citext--1.4.sql b/contrib/citext/citext--1.4.sql
index 7b06198..dfed78b 100644
--- a/contrib/citext/citext--1.4.sql
+++ b/contrib/citext/citext--1.4.sql
@@ -208,7 +208,7 @@ LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
--
CREATE OPERATOR CLASS citext_ops
-DEFAULT FOR TYPE CITEXT USING btree AS
+DEFAULT BITWISE FOR TYPE CITEXT USING btree AS
OPERATOR 1 < (citext, citext),
OPERATOR 2 <= (citext, citext),
OPERATOR 3 = (citext, citext),
@@ -221,7 +221,7 @@ DEFAULT FOR TYPE CITEXT USING btree AS
--
CREATE OPERATOR CLASS citext_ops
-DEFAULT FOR TYPE citext USING hash AS
+DEFAULT BITWISE FOR TYPE citext USING hash AS
OPERATOR 1 = (citext, citext),
FUNCTION 1 citext_hash(citext);
diff --git a/contrib/cube/cube--1.2.sql b/contrib/cube/cube--1.2.sql
index dea2614..faf5a06 100644
--- a/contrib/cube/cube--1.2.sql
+++ b/contrib/cube/cube--1.2.sql
@@ -347,7 +347,7 @@ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- Create the operator classes for indexing
CREATE OPERATOR CLASS cube_ops
- DEFAULT FOR TYPE cube USING btree AS
+ DEFAULT BITWISE FOR TYPE cube USING btree AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
@@ -356,7 +356,7 @@ CREATE OPERATOR CLASS cube_ops
FUNCTION 1 cube_cmp(cube, cube);
CREATE OPERATOR CLASS gist_cube_ops
- DEFAULT FOR TYPE cube USING gist AS
+ DEFAULT BITWISE FOR TYPE cube USING gist AS
OPERATOR 3 && ,
OPERATOR 6 = ,
OPERATOR 7 @> ,
diff --git a/contrib/hstore/hstore--1.4.sql b/contrib/hstore/hstore--1.4.sql
index 4294d14..d34896b 100644
--- a/contrib/hstore/hstore--1.4.sql
+++ b/contrib/hstore/hstore--1.4.sql
@@ -423,7 +423,7 @@ CREATE OPERATOR #>=# (
);
CREATE OPERATOR CLASS btree_hstore_ops
-DEFAULT FOR TYPE hstore USING btree
+DEFAULT BITWISE FOR TYPE hstore USING btree
AS
OPERATOR 1 #<# ,
OPERATOR 2 #<=# ,
@@ -440,7 +440,7 @@ AS 'MODULE_PATHNAME','hstore_hash'
LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE;
CREATE OPERATOR CLASS hash_hstore_ops
-DEFAULT FOR TYPE hstore USING hash
+DEFAULT BITWISE FOR TYPE hstore USING hash
AS
OPERATOR 1 = ,
FUNCTION 1 hstore_hash(hstore);
@@ -501,7 +501,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS gist_hstore_ops
-DEFAULT FOR TYPE hstore USING gist
+DEFAULT BITWISE FOR TYPE hstore USING gist
AS
OPERATOR 7 @> ,
OPERATOR 9 ?(hstore,text) ,
@@ -537,7 +537,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS gin_hstore_ops
-DEFAULT FOR TYPE hstore USING gin
+DEFAULT BITWISE FOR TYPE hstore USING gin
AS
OPERATOR 7 @>,
OPERATOR 9 ?(hstore,text),
diff --git a/contrib/intarray/intarray--1.2.sql b/contrib/intarray/intarray--1.2.sql
index f10b53d..4cca844 100644
--- a/contrib/intarray/intarray--1.2.sql
+++ b/contrib/intarray/intarray--1.2.sql
@@ -397,7 +397,7 @@ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- Create the operator class for indexing
CREATE OPERATOR CLASS gist__int_ops
-DEFAULT FOR TYPE _int4 USING gist AS
+DEFAULT BITWISE FOR TYPE _int4 USING gist AS
OPERATOR 3 &&,
OPERATOR 6 = (anyarray, anyarray),
OPERATOR 7 @>,
@@ -473,7 +473,7 @@ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- register the opclass for indexing (not as default)
CREATE OPERATOR CLASS gist__intbig_ops
-FOR TYPE _int4 USING gist
+BITWISE FOR TYPE _int4 USING gist
AS
OPERATOR 3 &&,
OPERATOR 6 = (anyarray, anyarray),
@@ -504,7 +504,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS gin__int_ops
-FOR TYPE _int4 USING gin
+BITWISE FOR TYPE _int4 USING gin
AS
OPERATOR 3 &&,
OPERATOR 6 = (anyarray, anyarray),
diff --git a/contrib/isn/isn--1.1.sql b/contrib/isn/isn--1.1.sql
index 5206961..f6514e3 100644
--- a/contrib/isn/isn--1.1.sql
+++ b/contrib/isn/isn--1.1.sql
@@ -2716,7 +2716,7 @@ CREATE FUNCTION btean13cmp(ean13, ean13)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS ean13_ops DEFAULT
+CREATE OPERATOR CLASS ean13_ops DEFAULT BITWISE
FOR TYPE ean13 USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -2731,7 +2731,7 @@ CREATE FUNCTION hashean13(ean13)
LANGUAGE 'internal' IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS ean13_ops DEFAULT
+CREATE OPERATOR CLASS ean13_ops DEFAULT BITWISE
FOR TYPE ean13 USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashean13(ean13);
@@ -2842,7 +2842,7 @@ CREATE FUNCTION btisbn13cmp(isbn13, isbn13)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS isbn13_ops DEFAULT
+CREATE OPERATOR CLASS isbn13_ops DEFAULT BITWISE
FOR TYPE isbn13 USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -2858,7 +2858,7 @@ CREATE FUNCTION hashisbn13(isbn13)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS isbn13_ops DEFAULT
+CREATE OPERATOR CLASS isbn13_ops DEFAULT BITWISE
FOR TYPE isbn13 USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashisbn13(isbn13);
@@ -2904,7 +2904,7 @@ CREATE FUNCTION btisbncmp(isbn, isbn)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS isbn_ops DEFAULT
+CREATE OPERATOR CLASS isbn_ops DEFAULT BITWISE
FOR TYPE isbn USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -2920,7 +2920,7 @@ CREATE FUNCTION hashisbn(isbn)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS isbn_ops DEFAULT
+CREATE OPERATOR CLASS isbn_ops DEFAULT BITWISE
FOR TYPE isbn USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashisbn(isbn);
@@ -2966,7 +2966,7 @@ CREATE FUNCTION btismn13cmp(ismn13, ismn13)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS ismn13_ops DEFAULT
+CREATE OPERATOR CLASS ismn13_ops DEFAULT BITWISE
FOR TYPE ismn13 USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -2982,7 +2982,7 @@ CREATE FUNCTION hashismn13(ismn13)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS ismn13_ops DEFAULT
+CREATE OPERATOR CLASS ismn13_ops DEFAULT BITWISE
FOR TYPE ismn13 USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashismn13(ismn13);
@@ -3028,7 +3028,7 @@ CREATE FUNCTION btismncmp(ismn, ismn)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS ismn_ops DEFAULT
+CREATE OPERATOR CLASS ismn_ops DEFAULT BITWISE
FOR TYPE ismn USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -3044,7 +3044,7 @@ CREATE FUNCTION hashismn(ismn)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS ismn_ops DEFAULT
+CREATE OPERATOR CLASS ismn_ops DEFAULT BITWISE
FOR TYPE ismn USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashismn(ismn);
@@ -3090,7 +3090,7 @@ CREATE FUNCTION btissn13cmp(issn13, issn13)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS issn13_ops DEFAULT
+CREATE OPERATOR CLASS issn13_ops DEFAULT BITWISE
FOR TYPE issn13 USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -3106,7 +3106,7 @@ CREATE FUNCTION hashissn13(issn13)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS issn13_ops DEFAULT
+CREATE OPERATOR CLASS issn13_ops DEFAULT BITWISE
FOR TYPE issn13 USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashissn13(issn13);
@@ -3152,7 +3152,7 @@ CREATE FUNCTION btissncmp(issn, issn)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS issn_ops DEFAULT
+CREATE OPERATOR CLASS issn_ops DEFAULT BITWISE
FOR TYPE issn USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -3168,7 +3168,7 @@ CREATE FUNCTION hashissn(issn)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS issn_ops DEFAULT
+CREATE OPERATOR CLASS issn_ops DEFAULT BITWISE
FOR TYPE issn USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashissn(issn);
@@ -3214,7 +3214,7 @@ CREATE FUNCTION btupccmp(upc, upc)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS upc_ops DEFAULT
+CREATE OPERATOR CLASS upc_ops DEFAULT BITWISE
FOR TYPE upc USING btree FAMILY isn_ops AS
OPERATOR 1 <,
OPERATOR 2 <=,
@@ -3230,7 +3230,7 @@ CREATE FUNCTION hashupc(upc)
IMMUTABLE STRICT
PARALLEL SAFE;
-CREATE OPERATOR CLASS upc_ops DEFAULT
+CREATE OPERATOR CLASS upc_ops DEFAULT BITWISE
FOR TYPE upc USING hash FAMILY isn_ops AS
OPERATOR 1 =,
FUNCTION 1 hashupc(upc);
diff --git a/contrib/ltree/ltree--1.1.sql b/contrib/ltree/ltree--1.1.sql
index d46f5fc..3198096 100644
--- a/contrib/ltree/ltree--1.1.sql
+++ b/contrib/ltree/ltree--1.1.sql
@@ -290,7 +290,7 @@ CREATE OPERATOR || (
-- B-tree support
CREATE OPERATOR CLASS ltree_ops
- DEFAULT FOR TYPE ltree USING btree AS
+ DEFAULT BITWISE FOR TYPE ltree USING btree AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
@@ -518,7 +518,7 @@ CREATE FUNCTION ltree_same(ltree_gist, ltree_gist, internal)
RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS gist_ltree_ops
- DEFAULT FOR TYPE ltree USING gist AS
+ DEFAULT BITWISE FOR TYPE ltree USING gist AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
@@ -853,7 +853,7 @@ AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
CREATE OPERATOR CLASS gist__ltree_ops
- DEFAULT FOR TYPE _ltree USING gist AS
+ DEFAULT BITWISE FOR TYPE _ltree USING gist AS
OPERATOR 10 <@ (_ltree, ltree),
OPERATOR 11 @> (ltree, _ltree),
OPERATOR 12 ~ (_ltree, lquery),
diff --git a/contrib/pg_trgm/pg_trgm--1.3.sql b/contrib/pg_trgm/pg_trgm--1.3.sql
index 5e08e87..ab917d2 100644
--- a/contrib/pg_trgm/pg_trgm--1.3.sql
+++ b/contrib/pg_trgm/pg_trgm--1.3.sql
@@ -168,7 +168,7 @@ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- create the operator class for gist
CREATE OPERATOR CLASS gist_trgm_ops
-FOR TYPE text USING gist
+BITWISE FOR TYPE text USING gist
AS
OPERATOR 1 % (text, text),
FUNCTION 1 gtrgm_consistent (internal, text, smallint, oid, internal),
@@ -221,7 +221,7 @@ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- create the operator class for gin
CREATE OPERATOR CLASS gin_trgm_ops
-FOR TYPE text USING gin
+BITWISE FOR TYPE text USING gin
AS
OPERATOR 1 % (text, text),
FUNCTION 1 btint4cmp (int4, int4),
diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out
index f0c842a..18bc5b9 100644
--- a/contrib/postgres_fdw/expected/postgres_fdw.out
+++ b/contrib/postgres_fdw/expected/postgres_fdw.out
@@ -3111,7 +3111,7 @@ create operator public.>^ (
create operator family my_op_family using btree;
create function my_op_cmp(a int, b int) returns int as
$$begin return btint4cmp(a, b); end $$ language plpgsql;
-create operator class my_op_class for type int using btree family my_op_family as
+create operator class my_op_class bitwise for type int using btree family my_op_family as
operator 1 public.<^,
operator 3 public.=^,
operator 5 public.>^,
diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql
index 630b803..4438663 100644
--- a/contrib/postgres_fdw/sql/postgres_fdw.sql
+++ b/contrib/postgres_fdw/sql/postgres_fdw.sql
@@ -825,7 +825,7 @@ create operator family my_op_family using btree;
create function my_op_cmp(a int, b int) returns int as
$$begin return btint4cmp(a, b); end $$ language plpgsql;
-create operator class my_op_class for type int using btree family my_op_family as
+create operator class my_op_class bitwise for type int using btree family my_op_family as
operator 1 public.<^,
operator 3 public.=^,
operator 5 public.>^,
diff --git a/contrib/seg/seg--1.1.sql b/contrib/seg/seg--1.1.sql
index d95aabc..b869071 100644
--- a/contrib/seg/seg--1.1.sql
+++ b/contrib/seg/seg--1.1.sql
@@ -365,7 +365,7 @@ LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
-- Create the operator classes for indexing
CREATE OPERATOR CLASS seg_ops
- DEFAULT FOR TYPE seg USING btree AS
+ DEFAULT BITWISE FOR TYPE seg USING btree AS
OPERATOR 1 < ,
OPERATOR 2 <= ,
OPERATOR 3 = ,
@@ -374,7 +374,7 @@ CREATE OPERATOR CLASS seg_ops
FUNCTION 1 seg_cmp(seg, seg);
CREATE OPERATOR CLASS gist_seg_ops
-DEFAULT FOR TYPE seg USING gist
+DEFAULT BITWISE FOR TYPE seg USING gist
AS
OPERATOR 1 << ,
OPERATOR 2 &< ,
diff --git a/doc/src/sgml/ref/create_opclass.sgml b/doc/src/sgml/ref/create_opclass.sgml
index dd5252f..8d0ddfc 100644
--- a/doc/src/sgml/ref/create_opclass.sgml
+++ b/doc/src/sgml/ref/create_opclass.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAULT ] FOR TYPE <replaceable class="parameter">data_type</replaceable>
+CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAULT | BITWISE ] FOR TYPE <replaceable class="parameter">data_type</replaceable>
USING <replaceable class="parameter">index_method</replaceable> [ FAMILY <replaceable class="parameter">family_name</replaceable> ] AS
{ OPERATOR <replaceable class="parameter">strategy_number</replaceable> <replaceable class="parameter">operator_name</replaceable> [ ( <replaceable class="parameter">op_type</replaceable>, <replaceable class="parameter">op_type</replaceable> ) ] [ FOR SEARCH | FOR ORDER BY <replaceable class="parameter">sort_family_name</replaceable> ]
| FUNCTION <replaceable class="parameter">support_number</replaceable> [ ( <replaceable class="parameter">op_type</replaceable> [ , <replaceable class="parameter">op_type</replaceable> ] ) ] <replaceable class="parameter">function_name</replaceable> ( <replaceable class="parameter">argument_type</replaceable> [, ...] )
@@ -106,6 +106,20 @@ CREATE OPERATOR CLASS <replaceable class="parameter">name</replaceable> [ DEFAUL
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><literal>BITWISE</literal></term>
+ <listitem>
+ <para>
+ If present, the operator class equality is the same as equivalence.
+ For example, two integers that compare equal are also binary equal,
+ while, numerics can compare equal but have different scales,
+ thus numeric opclass is not <literal>BITWISE</literal>. Even though,
+ most opclasses implement bitwise equal comparison, this behaviour
+ must be set explicitly.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><replaceable class="parameter">data_type</replaceable></term>
<listitem>
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index 6a1ccde..4e7180a 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -654,6 +654,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
values[Anum_pg_opclass_opcintype - 1] = ObjectIdGetDatum(typeoid);
values[Anum_pg_opclass_opcdefault - 1] = BoolGetDatum(stmt->isDefault);
values[Anum_pg_opclass_opckeytype - 1] = ObjectIdGetDatum(storageoid);
+ values[Anum_pg_opclass_opcisbitwise - 1] = BoolGetDatum(stmt->isBitwise);
tup = heap_form_tuple(rel->rd_att, values, nulls);
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 3432bb9..7c5dd7c 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -3785,6 +3785,7 @@ _copyCreateOpClassStmt(const CreateOpClassStmt *from)
COPY_NODE_FIELD(datatype);
COPY_NODE_FIELD(items);
COPY_SCALAR_FIELD(isDefault);
+ COPY_SCALAR_FIELD(isBitwise);
return newnode;
}
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 18cb014..d149cfb 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -1607,6 +1607,7 @@ _equalCreateOpClassStmt(const CreateOpClassStmt *a, const CreateOpClassStmt *b)
COMPARE_NODE_FIELD(datatype);
COMPARE_NODE_FIELD(items);
COMPARE_SCALAR_FIELD(isDefault);
+ COMPARE_SCALAR_FIELD(isBitwise);
return true;
}
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 3f67aaf..a2dee33 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -445,7 +445,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <boolean> opt_instead
%type <boolean> opt_unique opt_concurrently opt_verbose opt_full
-%type <boolean> opt_freeze opt_analyze opt_default opt_recheck
+%type <boolean> opt_freeze opt_analyze opt_default opt_recheck opt_bitwise
%type <defelt> opt_binary copy_delimiter
%type <boolean> copy_from opt_program
@@ -616,7 +616,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARRAY AS ASC
ASSERTION ASSIGNMENT ASYMMETRIC AT ATTACH ATTRIBUTE AUTHORIZATION
- BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
+ BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT BITWISE
BOOLEAN_P BOTH BY
CACHE CALL CALLED CASCADE CASCADED CASE CAST CATALOG_P CHAIN CHAR_P
@@ -5951,16 +5951,17 @@ opt_if_not_exists: IF_P NOT EXISTS { $$ = true; }
*****************************************************************************/
CreateOpClassStmt:
- CREATE OPERATOR CLASS any_name opt_default FOR TYPE_P Typename
+ CREATE OPERATOR CLASS any_name opt_default opt_bitwise FOR TYPE_P Typename
USING access_method opt_opfamily AS opclass_item_list
{
CreateOpClassStmt *n = makeNode(CreateOpClassStmt);
n->opclassname = $4;
n->isDefault = $5;
- n->datatype = $8;
- n->amname = $10;
- n->opfamilyname = $11;
- n->items = $13;
+ n->isBitwise = $6;
+ n->datatype = $9;
+ n->amname = $11;
+ n->opfamilyname = $12;
+ n->items = $14;
$$ = (Node *) n;
}
;
@@ -6023,6 +6024,10 @@ opt_default: DEFAULT { $$ = true; }
| /*EMPTY*/ { $$ = false; }
;
+opt_bitwise: BITWISE { $$ = true; }
+ | /*EMPTY*/ { $$ = false; }
+ ;
+
opt_opfamily: FAMILY any_name { $$ = $2; }
| /*EMPTY*/ { $$ = NIL; }
;
@@ -15066,6 +15071,7 @@ unreserved_keyword:
| BACKWARD
| BEFORE
| BEGIN_P
+ | BITWISE
| BY
| CACHE
| CALL
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index bf69adc..6a13d19 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12833,6 +12833,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
int i_opcintype;
int i_opckeytype;
int i_opcdefault;
+ int i_opcisbitwise;
int i_opcfamily;
int i_opcfamilyname;
int i_opcfamilynsp;
@@ -12849,6 +12850,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
char *opcintype;
char *opckeytype;
char *opcdefault;
+ char *opcisbitwise;
char *opcfamily;
char *opcfamilyname;
char *opcfamilynsp;
@@ -12875,11 +12877,25 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
nameusing = createPQExpBuffer();
/* Get additional fields from the pg_opclass row */
- if (fout->remoteVersion >= 80300)
+ if (fout->remoteVersion >= 13000)
+ {
+ appendPQExpBuffer(query, "SELECT opcintype::pg_catalog.regtype, "
+ "opckeytype::pg_catalog.regtype, "
+ "opcdefault, opcisbitwise, opcfamily, "
+ "opfname AS opcfamilyname, "
+ "nspname AS opcfamilynsp, "
+ "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcmethod) AS amname "
+ "FROM pg_catalog.pg_opclass c "
+ "LEFT JOIN pg_catalog.pg_opfamily f ON f.oid = opcfamily "
+ "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = opfnamespace "
+ "WHERE c.oid = '%u'::pg_catalog.oid",
+ opcinfo->dobj.catId.oid);
+ }
+ else if (fout->remoteVersion >= 80300)
{
appendPQExpBuffer(query, "SELECT opcintype::pg_catalog.regtype, "
"opckeytype::pg_catalog.regtype, "
- "opcdefault, opcfamily, "
+ "opcdefault, 'f' as opcisbitwise, opcfamily, "
"opfname AS opcfamilyname, "
"nspname AS opcfamilynsp, "
"(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcmethod) AS amname "
@@ -12893,7 +12909,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
{
appendPQExpBuffer(query, "SELECT opcintype::pg_catalog.regtype, "
"opckeytype::pg_catalog.regtype, "
- "opcdefault, NULL AS opcfamily, "
+ "opcdefault, 'f' as opcisbitwise, NULL AS opcfamily, "
"NULL AS opcfamilyname, "
"NULL AS opcfamilynsp, "
"(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcamid) AS amname "
@@ -12907,6 +12923,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
i_opcintype = PQfnumber(res, "opcintype");
i_opckeytype = PQfnumber(res, "opckeytype");
i_opcdefault = PQfnumber(res, "opcdefault");
+ i_opcisbitwise = PQfnumber(res, "opcisbitwise");
i_opcfamily = PQfnumber(res, "opcfamily");
i_opcfamilyname = PQfnumber(res, "opcfamilyname");
i_opcfamilynsp = PQfnumber(res, "opcfamilynsp");
@@ -12916,6 +12933,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
opcintype = pg_strdup(PQgetvalue(res, 0, i_opcintype));
opckeytype = PQgetvalue(res, 0, i_opckeytype);
opcdefault = PQgetvalue(res, 0, i_opcdefault);
+ opcisbitwise = PQgetvalue(res, 0, i_opcisbitwise);
/* opcfamily will still be needed after we PQclear res */
opcfamily = pg_strdup(PQgetvalue(res, 0, i_opcfamily));
opcfamilyname = PQgetvalue(res, 0, i_opcfamilyname);
@@ -12933,6 +12951,8 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
fmtQualifiedDumpable(opcinfo));
if (strcmp(opcdefault, "t") == 0)
appendPQExpBufferStr(q, "DEFAULT ");
+ if (strcmp(opcisbitwise, "t") == 0)
+ appendPQExpBufferStr(q, "BITWISE ");
appendPQExpBuffer(q, "FOR TYPE %s USING %s",
opcintype,
fmtId(amname));
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 1f6de76..7bc8dbd 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 201910251
+#define CATALOG_VERSION_NO 201910281
#endif
diff --git a/src/include/catalog/pg_opclass.dat b/src/include/catalog/pg_opclass.dat
index 2d57510..045d9b6 100644
--- a/src/include/catalog/pg_opclass.dat
+++ b/src/include/catalog/pg_opclass.dat
@@ -17,76 +17,76 @@
# assigned on-the-fly during initdb.
{ opcmethod => 'btree', opcname => 'array_ops', opcfamily => 'btree/array_ops',
- opcintype => 'anyarray' },
+ opcintype => 'anyarray', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'array_ops', opcfamily => 'hash/array_ops',
- opcintype => 'anyarray' },
+ opcintype => 'anyarray', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'bit_ops', opcfamily => 'btree/bit_ops',
- opcintype => 'bit' },
+ opcintype => 'bit', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'bool_ops', opcfamily => 'btree/bool_ops',
- opcintype => 'bool' },
+ opcintype => 'bool', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'bpchar_ops',
- opcfamily => 'btree/bpchar_ops', opcintype => 'bpchar' },
+ opcfamily => 'btree/bpchar_ops', opcintype => 'bpchar', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'bpchar_ops', opcfamily => 'hash/bpchar_ops',
- opcintype => 'bpchar' },
+ opcintype => 'bpchar', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'bytea_ops', opcfamily => 'btree/bytea_ops',
- opcintype => 'bytea' },
+ opcintype => 'bytea', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'char_ops', opcfamily => 'btree/char_ops',
- opcintype => 'char' },
+ opcintype => 'char', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'char_ops', opcfamily => 'hash/char_ops',
- opcintype => 'char' },
+ opcintype => 'char', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'cidr_ops', opcfamily => 'btree/network_ops',
- opcintype => 'inet', opcdefault => 'f' },
+ opcintype => 'inet', opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'cidr_ops', opcfamily => 'hash/network_ops',
- opcintype => 'inet', opcdefault => 'f' },
+ opcintype => 'inet', opcdefault => 'f', opcisbitwise => 't'},
{ oid => '3122', oid_symbol => 'DATE_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'date_ops',
- opcfamily => 'btree/datetime_ops', opcintype => 'date' },
+ opcfamily => 'btree/datetime_ops', opcintype => 'date', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'date_ops', opcfamily => 'hash/date_ops',
- opcintype => 'date' },
+ opcintype => 'date', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'float4_ops', opcfamily => 'btree/float_ops',
- opcintype => 'float4' },
+ opcintype => 'float4', opcisbitwise => 'f'},
{ opcmethod => 'hash', opcname => 'float4_ops', opcfamily => 'hash/float_ops',
- opcintype => 'float4' },
+ opcintype => 'float4', opcisbitwise => 'f'},
{ oid => '3123', oid_symbol => 'FLOAT8_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'float8_ops', opcfamily => 'btree/float_ops',
- opcintype => 'float8' },
+ opcintype => 'float8', opcisbitwise => 'f'},
{ opcmethod => 'hash', opcname => 'float8_ops', opcfamily => 'hash/float_ops',
- opcintype => 'float8' },
+ opcintype => 'float8', opcisbitwise => 'f'},
{ opcmethod => 'btree', opcname => 'inet_ops', opcfamily => 'btree/network_ops',
- opcintype => 'inet' },
+ opcintype => 'inet', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'inet_ops', opcfamily => 'hash/network_ops',
- opcintype => 'inet' },
+ opcintype => 'inet', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'inet_ops', opcfamily => 'gist/network_ops',
- opcintype => 'inet', opcdefault => 'f' },
+ opcintype => 'inet', opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'spgist', opcname => 'inet_ops',
- opcfamily => 'spgist/network_ops', opcintype => 'inet' },
+ opcfamily => 'spgist/network_ops', opcintype => 'inet', opcisbitwise => 't'},
{ oid => '1979', oid_symbol => 'INT2_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'int2_ops', opcfamily => 'btree/integer_ops',
- opcintype => 'int2' },
+ opcintype => 'int2', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'int2_ops', opcfamily => 'hash/integer_ops',
- opcintype => 'int2' },
+ opcintype => 'int2', opcisbitwise => 't'},
{ oid => '1978', oid_symbol => 'INT4_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'int4_ops', opcfamily => 'btree/integer_ops',
- opcintype => 'int4' },
+ opcintype => 'int4', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'int4_ops', opcfamily => 'hash/integer_ops',
- opcintype => 'int4' },
+ opcintype => 'int4', opcisbitwise => 't'},
{ oid => '3124', oid_symbol => 'INT8_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'int8_ops', opcfamily => 'btree/integer_ops',
- opcintype => 'int8' },
+ opcintype => 'int8', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'int8_ops', opcfamily => 'hash/integer_ops',
- opcintype => 'int8' },
+ opcintype => 'int8', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'interval_ops',
- opcfamily => 'btree/interval_ops', opcintype => 'interval' },
+ opcfamily => 'btree/interval_ops', opcintype => 'interval', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'interval_ops',
- opcfamily => 'hash/interval_ops', opcintype => 'interval' },
+ opcfamily => 'hash/interval_ops', opcintype => 'interval', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'macaddr_ops',
- opcfamily => 'btree/macaddr_ops', opcintype => 'macaddr' },
+ opcfamily => 'btree/macaddr_ops', opcintype => 'macaddr', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'macaddr_ops',
- opcfamily => 'hash/macaddr_ops', opcintype => 'macaddr' },
+ opcfamily => 'hash/macaddr_ops', opcintype => 'macaddr', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'macaddr8_ops',
- opcfamily => 'btree/macaddr8_ops', opcintype => 'macaddr8' },
+ opcfamily => 'btree/macaddr8_ops', opcintype => 'macaddr8', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'macaddr8_ops',
- opcfamily => 'hash/macaddr8_ops', opcintype => 'macaddr8' },
+ opcfamily => 'hash/macaddr8_ops', opcintype => 'macaddr8', opcisbitwise => 't'},
# Here's an ugly little hack to save space in the system catalog indexes.
# btree doesn't ordinarily allow a storage type different from input type;
@@ -94,157 +94,159 @@
# and we can safely omit that within an index entry. So we declare the
# btree opclass for name as using cstring storage type.
{ opcmethod => 'btree', opcname => 'name_ops', opcfamily => 'btree/text_ops',
- opcintype => 'name', opckeytype => 'cstring' },
+ opcintype => 'name', opckeytype => 'cstring', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'name_ops', opcfamily => 'hash/text_ops',
- opcintype => 'name' },
+ opcintype => 'name', opcisbitwise => 't'},
{ oid => '3125', oid_symbol => 'NUMERIC_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'numeric_ops',
- opcfamily => 'btree/numeric_ops', opcintype => 'numeric' },
+ opcfamily => 'btree/numeric_ops', opcintype => 'numeric',
+ opcisbitwise => 'f'},
{ opcmethod => 'hash', opcname => 'numeric_ops',
- opcfamily => 'hash/numeric_ops', opcintype => 'numeric' },
+ opcfamily => 'hash/numeric_ops', opcintype => 'numeric',
+ opcisbitwise => 'f'},
{ oid => '1981', oid_symbol => 'OID_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'oid_ops', opcfamily => 'btree/oid_ops',
- opcintype => 'oid' },
+ opcintype => 'oid', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'oid_ops', opcfamily => 'hash/oid_ops',
- opcintype => 'oid' },
+ opcintype => 'oid', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'oidvector_ops',
- opcfamily => 'btree/oidvector_ops', opcintype => 'oidvector' },
+ opcfamily => 'btree/oidvector_ops', opcintype => 'oidvector', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'oidvector_ops',
- opcfamily => 'hash/oidvector_ops', opcintype => 'oidvector' },
+ opcfamily => 'hash/oidvector_ops', opcintype => 'oidvector', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'record_ops',
- opcfamily => 'btree/record_ops', opcintype => 'record' },
+ opcfamily => 'btree/record_ops', opcintype => 'record', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'record_image_ops',
opcfamily => 'btree/record_image_ops', opcintype => 'record',
- opcdefault => 'f' },
+ opcdefault => 'f', opcisbitwise => 't'},
{ oid => '3126', oid_symbol => 'TEXT_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'text_ops', opcfamily => 'btree/text_ops',
- opcintype => 'text' },
+ opcintype => 'text', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'text_ops', opcfamily => 'hash/text_ops',
- opcintype => 'text' },
+ opcintype => 'text', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'time_ops', opcfamily => 'btree/time_ops',
- opcintype => 'time' },
+ opcintype => 'time', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'time_ops', opcfamily => 'hash/time_ops',
- opcintype => 'time' },
+ opcintype => 'time', opcisbitwise => 't'},
{ oid => '3127', oid_symbol => 'TIMESTAMPTZ_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'timestamptz_ops',
- opcfamily => 'btree/datetime_ops', opcintype => 'timestamptz' },
+ opcfamily => 'btree/datetime_ops', opcintype => 'timestamptz', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'timestamptz_ops',
- opcfamily => 'hash/timestamptz_ops', opcintype => 'timestamptz' },
+ opcfamily => 'hash/timestamptz_ops', opcintype => 'timestamptz', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'timetz_ops',
- opcfamily => 'btree/timetz_ops', opcintype => 'timetz' },
+ opcfamily => 'btree/timetz_ops', opcintype => 'timetz', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'timetz_ops', opcfamily => 'hash/timetz_ops',
- opcintype => 'timetz' },
+ opcintype => 'timetz', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'varbit_ops',
- opcfamily => 'btree/varbit_ops', opcintype => 'varbit' },
+ opcfamily => 'btree/varbit_ops', opcintype => 'varbit', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'varchar_ops', opcfamily => 'btree/text_ops',
- opcintype => 'text', opcdefault => 'f' },
+ opcintype => 'text', opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'varchar_ops', opcfamily => 'hash/text_ops',
- opcintype => 'text', opcdefault => 'f' },
+ opcintype => 'text', opcdefault => 'f', opcisbitwise => 't'},
{ oid => '3128', oid_symbol => 'TIMESTAMP_BTREE_OPS_OID',
opcmethod => 'btree', opcname => 'timestamp_ops',
- opcfamily => 'btree/datetime_ops', opcintype => 'timestamp' },
+ opcfamily => 'btree/datetime_ops', opcintype => 'timestamp', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'timestamp_ops',
- opcfamily => 'hash/timestamp_ops', opcintype => 'timestamp' },
+ opcfamily => 'hash/timestamp_ops', opcintype => 'timestamp', opcisbitwise => 't'},
{ oid => '4217', oid_symbol => 'TEXT_BTREE_PATTERN_OPS_OID',
opcmethod => 'btree', opcname => 'text_pattern_ops',
opcfamily => 'btree/text_pattern_ops', opcintype => 'text',
- opcdefault => 'f' },
+ opcdefault => 'f', opcisbitwise => 't'},
{ oid => '4218', oid_symbol => 'VARCHAR_BTREE_PATTERN_OPS_OID',
opcmethod => 'btree', opcname => 'varchar_pattern_ops',
opcfamily => 'btree/text_pattern_ops', opcintype => 'text',
- opcdefault => 'f' },
+ opcdefault => 'f', opcisbitwise => 't'},
{ oid => '4219', oid_symbol => 'BPCHAR_BTREE_PATTERN_OPS_OID',
opcmethod => 'btree', opcname => 'bpchar_pattern_ops',
opcfamily => 'btree/bpchar_pattern_ops', opcintype => 'bpchar',
- opcdefault => 'f' },
+ opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'money_ops', opcfamily => 'btree/money_ops',
- opcintype => 'money' },
+ opcintype => 'money', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'bool_ops', opcfamily => 'hash/bool_ops',
- opcintype => 'bool' },
+ opcintype => 'bool', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'bytea_ops', opcfamily => 'hash/bytea_ops',
- opcintype => 'bytea' },
+ opcintype => 'bytea', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'tid_ops', opcfamily => 'btree/tid_ops',
- opcintype => 'tid' },
+ opcintype => 'tid', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'xid_ops', opcfamily => 'hash/xid_ops',
- opcintype => 'xid' },
+ opcintype => 'xid', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'cid_ops', opcfamily => 'hash/cid_ops',
- opcintype => 'cid' },
+ opcintype => 'cid', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'tid_ops', opcfamily => 'hash/tid_ops',
- opcintype => 'tid' },
+ opcintype => 'tid', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'text_pattern_ops',
opcfamily => 'hash/text_pattern_ops', opcintype => 'text',
- opcdefault => 'f' },
+ opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'varchar_pattern_ops',
opcfamily => 'hash/text_pattern_ops', opcintype => 'text',
- opcdefault => 'f' },
+ opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'bpchar_pattern_ops',
opcfamily => 'hash/bpchar_pattern_ops', opcintype => 'bpchar',
- opcdefault => 'f' },
+ opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'aclitem_ops',
- opcfamily => 'hash/aclitem_ops', opcintype => 'aclitem' },
+ opcfamily => 'hash/aclitem_ops', opcintype => 'aclitem', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'box_ops', opcfamily => 'gist/box_ops',
- opcintype => 'box' },
+ opcintype => 'box', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'point_ops', opcfamily => 'gist/point_ops',
- opcintype => 'point', opckeytype => 'box' },
+ opcintype => 'point', opckeytype => 'box', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'poly_ops', opcfamily => 'gist/poly_ops',
- opcintype => 'polygon', opckeytype => 'box' },
+ opcintype => 'polygon', opckeytype => 'box', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'circle_ops', opcfamily => 'gist/circle_ops',
- opcintype => 'circle', opckeytype => 'box' },
+ opcintype => 'circle', opckeytype => 'box', opcisbitwise => 't'},
{ opcmethod => 'gin', opcname => 'array_ops', opcfamily => 'gin/array_ops',
- opcintype => 'anyarray', opckeytype => 'anyelement' },
+ opcintype => 'anyarray', opckeytype => 'anyelement', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'uuid_ops', opcfamily => 'btree/uuid_ops',
- opcintype => 'uuid' },
+ opcintype => 'uuid', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'uuid_ops', opcfamily => 'hash/uuid_ops',
- opcintype => 'uuid' },
+ opcintype => 'uuid', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'pg_lsn_ops',
- opcfamily => 'btree/pg_lsn_ops', opcintype => 'pg_lsn' },
+ opcfamily => 'btree/pg_lsn_ops', opcintype => 'pg_lsn', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'pg_lsn_ops', opcfamily => 'hash/pg_lsn_ops',
- opcintype => 'pg_lsn' },
+ opcintype => 'pg_lsn', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'enum_ops', opcfamily => 'btree/enum_ops',
- opcintype => 'anyenum' },
+ opcintype => 'anyenum', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'enum_ops', opcfamily => 'hash/enum_ops',
- opcintype => 'anyenum' },
+ opcintype => 'anyenum', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'tsvector_ops',
- opcfamily => 'btree/tsvector_ops', opcintype => 'tsvector' },
+ opcfamily => 'btree/tsvector_ops', opcintype => 'tsvector', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'tsvector_ops',
opcfamily => 'gist/tsvector_ops', opcintype => 'tsvector',
- opckeytype => 'gtsvector' },
+ opckeytype => 'gtsvector', opcisbitwise => 't'},
{ opcmethod => 'gin', opcname => 'tsvector_ops',
opcfamily => 'gin/tsvector_ops', opcintype => 'tsvector',
- opckeytype => 'text' },
+ opckeytype => 'text', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'tsquery_ops',
- opcfamily => 'btree/tsquery_ops', opcintype => 'tsquery' },
+ opcfamily => 'btree/tsquery_ops', opcintype => 'tsquery', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'tsquery_ops',
opcfamily => 'gist/tsquery_ops', opcintype => 'tsquery',
- opckeytype => 'int8' },
+ opckeytype => 'int8', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'range_ops', opcfamily => 'btree/range_ops',
- opcintype => 'anyrange' },
+ opcintype => 'anyrange', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'range_ops', opcfamily => 'hash/range_ops',
- opcintype => 'anyrange' },
+ opcintype => 'anyrange', opcisbitwise => 't'},
{ opcmethod => 'gist', opcname => 'range_ops', opcfamily => 'gist/range_ops',
- opcintype => 'anyrange' },
+ opcintype => 'anyrange', opcisbitwise => 't'},
{ opcmethod => 'spgist', opcname => 'range_ops',
- opcfamily => 'spgist/range_ops', opcintype => 'anyrange' },
+ opcfamily => 'spgist/range_ops', opcintype => 'anyrange', opcisbitwise => 't'},
{ opcmethod => 'spgist', opcname => 'box_ops', opcfamily => 'spgist/box_ops',
- opcintype => 'box' },
+ opcintype => 'box', opcisbitwise => 't'},
{ opcmethod => 'spgist', opcname => 'quad_point_ops',
- opcfamily => 'spgist/quad_point_ops', opcintype => 'point' },
+ opcfamily => 'spgist/quad_point_ops', opcintype => 'point', opcisbitwise => 't'},
{ opcmethod => 'spgist', opcname => 'kd_point_ops',
- opcfamily => 'spgist/kd_point_ops', opcintype => 'point', opcdefault => 'f' },
+ opcfamily => 'spgist/kd_point_ops', opcintype => 'point', opcdefault => 'f', opcisbitwise => 't'},
{ opcmethod => 'spgist', opcname => 'text_ops', opcfamily => 'spgist/text_ops',
- opcintype => 'text' },
+ opcintype => 'text', opcisbitwise => 't'},
{ opcmethod => 'spgist', opcname => 'poly_ops', opcfamily => 'spgist/poly_ops',
- opcintype => 'polygon', opckeytype => 'box' },
+ opcintype => 'polygon', opckeytype => 'box', opcisbitwise => 't'},
{ opcmethod => 'btree', opcname => 'jsonb_ops', opcfamily => 'btree/jsonb_ops',
- opcintype => 'jsonb' },
+ opcintype => 'jsonb', opcisbitwise => 't'},
{ opcmethod => 'hash', opcname => 'jsonb_ops', opcfamily => 'hash/jsonb_ops',
- opcintype => 'jsonb' },
+ opcintype => 'jsonb', opcisbitwise => 't'},
{ opcmethod => 'gin', opcname => 'jsonb_ops', opcfamily => 'gin/jsonb_ops',
- opcintype => 'jsonb', opckeytype => 'text' },
+ opcintype => 'jsonb', opckeytype => 'text', opcisbitwise => 't'},
{ opcmethod => 'gin', opcname => 'jsonb_path_ops',
opcfamily => 'gin/jsonb_path_ops', opcintype => 'jsonb', opcdefault => 'f',
- opckeytype => 'int4' },
+ opckeytype => 'int4', opcisbitwise => 't'},
# BRIN operator classes
@@ -252,94 +254,94 @@
{ opcmethod => 'brin', opcname => 'bytea_minmax_ops',
opcfamily => 'brin/bytea_minmax_ops', opcintype => 'bytea',
- opckeytype => 'bytea' },
+ opckeytype => 'bytea', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'char_minmax_ops',
opcfamily => 'brin/char_minmax_ops', opcintype => 'char',
- opckeytype => 'char' },
+ opckeytype => 'char', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'name_minmax_ops',
opcfamily => 'brin/name_minmax_ops', opcintype => 'name',
- opckeytype => 'name' },
+ opckeytype => 'name', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'int8_minmax_ops',
opcfamily => 'brin/integer_minmax_ops', opcintype => 'int8',
- opckeytype => 'int8' },
+ opckeytype => 'int8', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'int2_minmax_ops',
opcfamily => 'brin/integer_minmax_ops', opcintype => 'int2',
- opckeytype => 'int2' },
+ opckeytype => 'int2', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'int4_minmax_ops',
opcfamily => 'brin/integer_minmax_ops', opcintype => 'int4',
- opckeytype => 'int4' },
+ opckeytype => 'int4', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'text_minmax_ops',
opcfamily => 'brin/text_minmax_ops', opcintype => 'text',
- opckeytype => 'text' },
+ opckeytype => 'text', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'oid_minmax_ops',
- opcfamily => 'brin/oid_minmax_ops', opcintype => 'oid', opckeytype => 'oid' },
+ opcfamily => 'brin/oid_minmax_ops', opcintype => 'oid', opckeytype => 'oid', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'tid_minmax_ops',
- opcfamily => 'brin/tid_minmax_ops', opcintype => 'tid', opckeytype => 'tid' },
+ opcfamily => 'brin/tid_minmax_ops', opcintype => 'tid', opckeytype => 'tid', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'float4_minmax_ops',
opcfamily => 'brin/float_minmax_ops', opcintype => 'float4',
- opckeytype => 'float4' },
+ opckeytype => 'float4', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'float8_minmax_ops',
opcfamily => 'brin/float_minmax_ops', opcintype => 'float8',
- opckeytype => 'float8' },
+ opckeytype => 'float8', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'macaddr_minmax_ops',
opcfamily => 'brin/macaddr_minmax_ops', opcintype => 'macaddr',
- opckeytype => 'macaddr' },
+ opckeytype => 'macaddr', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'macaddr8_minmax_ops',
opcfamily => 'brin/macaddr8_minmax_ops', opcintype => 'macaddr8',
- opckeytype => 'macaddr8' },
+ opckeytype => 'macaddr8', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'inet_minmax_ops',
opcfamily => 'brin/network_minmax_ops', opcintype => 'inet',
- opcdefault => 'f', opckeytype => 'inet' },
+ opcdefault => 'f', opckeytype => 'inet', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'inet_inclusion_ops',
opcfamily => 'brin/network_inclusion_ops', opcintype => 'inet',
- opckeytype => 'inet' },
+ opckeytype => 'inet', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'bpchar_minmax_ops',
opcfamily => 'brin/bpchar_minmax_ops', opcintype => 'bpchar',
- opckeytype => 'bpchar' },
+ opckeytype => 'bpchar', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'time_minmax_ops',
opcfamily => 'brin/time_minmax_ops', opcintype => 'time',
- opckeytype => 'time' },
+ opckeytype => 'time', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'date_minmax_ops',
opcfamily => 'brin/datetime_minmax_ops', opcintype => 'date',
- opckeytype => 'date' },
+ opckeytype => 'date', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'timestamp_minmax_ops',
opcfamily => 'brin/datetime_minmax_ops', opcintype => 'timestamp',
- opckeytype => 'timestamp' },
+ opckeytype => 'timestamp', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'timestamptz_minmax_ops',
opcfamily => 'brin/datetime_minmax_ops', opcintype => 'timestamptz',
- opckeytype => 'timestamptz' },
+ opckeytype => 'timestamptz', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'interval_minmax_ops',
opcfamily => 'brin/interval_minmax_ops', opcintype => 'interval',
- opckeytype => 'interval' },
+ opckeytype => 'interval', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'timetz_minmax_ops',
opcfamily => 'brin/timetz_minmax_ops', opcintype => 'timetz',
- opckeytype => 'timetz' },
+ opckeytype => 'timetz', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'bit_minmax_ops',
- opcfamily => 'brin/bit_minmax_ops', opcintype => 'bit', opckeytype => 'bit' },
+ opcfamily => 'brin/bit_minmax_ops', opcintype => 'bit', opckeytype => 'bit', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'varbit_minmax_ops',
opcfamily => 'brin/varbit_minmax_ops', opcintype => 'varbit',
- opckeytype => 'varbit' },
+ opckeytype => 'varbit', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'numeric_minmax_ops',
opcfamily => 'brin/numeric_minmax_ops', opcintype => 'numeric',
- opckeytype => 'numeric' },
+ opckeytype => 'numeric', opcisbitwise => 't'},
# no brin opclass for record, anyarray
{ opcmethod => 'brin', opcname => 'uuid_minmax_ops',
opcfamily => 'brin/uuid_minmax_ops', opcintype => 'uuid',
- opckeytype => 'uuid' },
+ opckeytype => 'uuid', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'range_inclusion_ops',
opcfamily => 'brin/range_inclusion_ops', opcintype => 'anyrange',
- opckeytype => 'anyrange' },
+ opckeytype => 'anyrange', opcisbitwise => 't'},
{ opcmethod => 'brin', opcname => 'pg_lsn_minmax_ops',
opcfamily => 'brin/pg_lsn_minmax_ops', opcintype => 'pg_lsn',
- opckeytype => 'pg_lsn' },
+ opckeytype => 'pg_lsn', opcisbitwise => 't'},
# no brin opclass for enum, tsvector, tsquery, jsonb
{ opcmethod => 'brin', opcname => 'box_inclusion_ops',
opcfamily => 'brin/box_inclusion_ops', opcintype => 'box',
- opckeytype => 'box' },
+ opckeytype => 'box', opcisbitwise => 't'},
# no brin opclass for the geometric types except box
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index 84853c1..9ab32b3 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -73,6 +73,9 @@ CATALOG(pg_opclass,2616,OperatorClassRelationId)
/* type of data in index, or InvalidOid */
Oid opckeytype BKI_DEFAULT(0) BKI_LOOKUP(pg_type);
+
+ /* T if opclass equality also means "bitwise equality" */
+ bool opcisbitwise BKI_DEFAULT(f);
} FormData_pg_opclass;
/* ----------------
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index d93a79a..4ab4cc7 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2577,6 +2577,7 @@ typedef struct CreateOpClassStmt
TypeName *datatype; /* datatype of indexed column */
List *items; /* List of CreateOpClassItem nodes */
bool isDefault; /* Should be marked as default for type? */
+ bool isBitwise; /* Is opclass equality bitwise? */
} CreateOpClassStmt;
#define OPCLASS_ITEM_OPERATOR 1
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index 00ace84..d6a8e8f 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -58,6 +58,7 @@ PG_KEYWORD("between", BETWEEN, COL_NAME_KEYWORD)
PG_KEYWORD("bigint", BIGINT, COL_NAME_KEYWORD)
PG_KEYWORD("binary", BINARY, TYPE_FUNC_NAME_KEYWORD)
PG_KEYWORD("bit", BIT, COL_NAME_KEYWORD)
+PG_KEYWORD("bitwise", BITWISE, UNRESERVED_KEYWORD)
PG_KEYWORD("boolean", BOOLEAN_P, COL_NAME_KEYWORD)
PG_KEYWORD("both", BOTH, RESERVED_KEYWORD)
PG_KEYWORD("by", BY, UNRESERVED_KEYWORD)
diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out
index 84da403..241b61c 100644
--- a/src/test/regress/expected/create_am.out
+++ b/src/test/regress/expected/create_am.out
@@ -13,7 +13,7 @@ CREATE INDEX grect2ind2 ON fast_emp4000 USING gist2 (home_base);
ERROR: data type box has no default operator class for access method "gist2"
HINT: You must specify an operator class for the index or define a default operator class for the data type.
-- Make operator class for boxes using gist2
-CREATE OPERATOR CLASS box_ops DEFAULT
+CREATE OPERATOR CLASS box_ops DEFAULT BITWISE
FOR TYPE box USING gist2 AS
OPERATOR 1 <<,
OPERATOR 2 &<,
diff --git a/src/test/regress/sql/create_am.sql b/src/test/regress/sql/create_am.sql
index a7f6de7..46b5ca0 100644
--- a/src/test/regress/sql/create_am.sql
+++ b/src/test/regress/sql/create_am.sql
@@ -14,7 +14,7 @@ CREATE ACCESS METHOD bogus TYPE INDEX HANDLER heap_tableam_handler;
CREATE INDEX grect2ind2 ON fast_emp4000 USING gist2 (home_base);
-- Make operator class for boxes using gist2
-CREATE OPERATOR CLASS box_ops DEFAULT
+CREATE OPERATOR CLASS box_ops DEFAULT BITWISE
FOR TYPE box USING gist2 AS
OPERATOR 1 <<,
OPERATOR 2 &<,