Patch of intarray module in v7.4.1

Started by Korea PostgreSQL Users' Groupover 22 years ago2 messagespatches
Jump to latest
#1Korea PostgreSQL Users' Group
pgsql-kr@postgresql.or.kr

In 7.4.1, intarray module have a problme about equal operator (=).

select * from table where intarray_column = '{}';

above query make error.
because when not equal operator (<>) is made,
this make incorrect equal operator by implicate.

so, I patched.
Patch content is here.

===== BEGIN of FILE =====
--- _int.sql.in.orig	Thu Jun 12 03:44:15 2003
+++ _int.sql.in	Wed Jan  7 13:14:37 2004
@@ -140,15 +140,15 @@
 --	SORT2 = '<'
 --);
-CREATE OPERATOR <> (
-	LEFTARG = _int4,
-	RIGHTARG = _int4,
-	PROCEDURE = _int_different,
-	COMMUTATOR = '<>',
-	NEGATOR = '=',
-	RESTRICT = neqsel,
-	JOIN = neqjoinsel
-);
+--CREATE OPERATOR <> (
+--	LEFTARG = _int4,
+--	RIGHTARG = _int4,
+--	PROCEDURE = _int_different,
+--	COMMUTATOR = '<>',
+--	NEGATOR = '=',
+--	RESTRICT = neqsel,
+--	JOIN = neqjoinsel
+--);
 CREATE OPERATOR @ (
 	LEFTARG = _int4,
@@ -343,7 +343,7 @@
 CREATE OPERATOR CLASS gist__int_ops
 DEFAULT FOR TYPE _int4 USING gist AS
 	OPERATOR	3	&&,
-	OPERATOR	6	=	RECHECK,
+	OPERATOR	6	= (anyarray, anyarray)	RECHECK,
 	OPERATOR	7	@,
 	OPERATOR	8	~,
 	OPERATOR	20	@@ (_int4, query_int),
@@ -418,7 +418,7 @@
 FOR TYPE _int4 USING gist
 AS
 	OPERATOR	3	&&	RECHECK,
-	OPERATOR	6	=	RECHECK,
+	OPERATOR	6	= (anyarray, anyarray)	RECHECK,
 	OPERATOR	7	@	RECHECK,
 	OPERATOR	8	~	RECHECK,
 	OPERATOR	20	@@ (_int4, query_int)	RECHECK,
===== End of FILE =====
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Korea PostgreSQL Users' Group (#1)
Re: Patch of intarray module in v7.4.1

"Korea PostgreSQL Users' Group" <pgsql-kr@postgresql.or.kr> writes:

In 7.4.1, intarray module have a problme about equal operator (=).
select * from table where intarray_column = '{}';
above query make error.

Good catch. Patch applied --- thanks!

regards, tom lane