mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-22 12:23:32 +02:00
blanks, in hopes of reducing the surprise factor for newbies. Remove redundant operators for VARCHAR (it depends wholly on TEXT operations now). Clean up resolution of ambiguous operators/functions to avoid surprising choices for domains: domains are treated as equivalent to their base types and binary-coercibility is no longer considered a preference item when choosing among multiple operators/functions. IsBinaryCoercible now correctly reflects the notion that you need *only* relabel the type to get from type A to type B: that is, a domain is binary-coercible to its base type, but not vice versa. Various marginal cleanup, including merging the essentially duplicate resolution code in parse_func.c and parse_oper.c. Improve opr_sanity regression test to understand about binary compatibility (using pg_cast), and fix a couple of small errors in the catalogs revealed thereby. Restructure "special operator" handling to fetch operators via index opclasses rather than hardwiring assumptions about names (cleans up the pattern_ops stuff a little).
330 lines
6.6 KiB
MySQL
330 lines
6.6 KiB
MySQL
-- SQL code to define the new array iterator functions and operators
|
|
|
|
-- define the array operators *=, **=, *~ and **~ for type _text
|
|
--
|
|
|
|
-- Adjust this setting to control where the objects get created.
|
|
SET search_path = public;
|
|
|
|
CREATE OR REPLACE FUNCTION array_texteq(_text, text)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_texteq(_text, text)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_textregexeq(_text, text)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_textregexeq(_text, text)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
DROP OPERATOR *=(_text,text);
|
|
CREATE OPERATOR *= (
|
|
LEFTARG=_text,
|
|
RIGHTARG=text,
|
|
PROCEDURE=array_texteq
|
|
);
|
|
|
|
DROP OPERATOR **=(_text,text);
|
|
CREATE OPERATOR **= (
|
|
LEFTARG=_text,
|
|
RIGHTARG=text,
|
|
PROCEDURE=array_all_texteq
|
|
);
|
|
|
|
DROP OPERATOR *~(_text,text);
|
|
CREATE OPERATOR *~ (
|
|
LEFTARG=_text,
|
|
RIGHTARG=text,
|
|
PROCEDURE=array_textregexeq
|
|
);
|
|
|
|
DROP OPERATOR **~(_text,text);
|
|
CREATE OPERATOR **~ (
|
|
LEFTARG=_text,
|
|
RIGHTARG=text,
|
|
PROCEDURE=array_all_textregexeq
|
|
);
|
|
|
|
|
|
-- define the array operators *=, **=, *~ and **~ for type _bpchar
|
|
--
|
|
CREATE OR REPLACE FUNCTION array_bpchareq(_bpchar, bpchar)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_bpchareq(_bpchar, bpchar)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_bpcharregexeq(_bpchar, bpchar)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_bpcharregexeq(_bpchar, bpchar)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
DROP OPERATOR *=(_bpchar,bpchar);
|
|
CREATE OPERATOR *= (
|
|
LEFTARG=_bpchar,
|
|
RIGHTARG=bpchar,
|
|
PROCEDURE=array_bpchareq
|
|
);
|
|
|
|
DROP OPERATOR **=(_bpchar,bpchar);
|
|
CREATE OPERATOR **= (
|
|
LEFTARG=_bpchar,
|
|
RIGHTARG=bpchar,
|
|
PROCEDURE=array_all_bpchareq
|
|
);
|
|
|
|
DROP OPERATOR *~(_bpchar,bpchar);
|
|
CREATE OPERATOR *~ (
|
|
LEFTARG=_bpchar,
|
|
RIGHTARG=bpchar,
|
|
PROCEDURE=array_bpcharregexeq
|
|
);
|
|
|
|
DROP OPERATOR **~(_bpchar,bpchar);
|
|
CREATE OPERATOR **~ (
|
|
LEFTARG=_bpchar,
|
|
RIGHTARG=bpchar,
|
|
PROCEDURE=array_all_bpcharregexeq
|
|
);
|
|
|
|
|
|
-- define the array operators *=, **=, *> and **> for type _int4
|
|
--
|
|
CREATE OR REPLACE FUNCTION array_int4eq(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_int4eq(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_int4ne(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_int4ne(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_int4gt(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_int4gt(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_int4ge(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_int4ge(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_int4lt(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_int4lt(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_int4le(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_int4le(_int4, int4)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
DROP OPERATOR *=(_int4,int4);
|
|
CREATE OPERATOR *= (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_int4eq
|
|
);
|
|
|
|
DROP OPERATOR **=(_int4,int4);
|
|
CREATE OPERATOR **= (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_all_int4eq
|
|
);
|
|
|
|
DROP OPERATOR *<>(_int4,int4);
|
|
CREATE OPERATOR *<> (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_int4ne
|
|
);
|
|
|
|
DROP OPERATOR **<>(_int4,int4);
|
|
CREATE OPERATOR **<> (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_all_int4ne
|
|
);
|
|
|
|
DROP OPERATOR *>(_int4,int4);
|
|
CREATE OPERATOR *> (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_int4gt
|
|
);
|
|
|
|
DROP OPERATOR **>(_int4,int4);
|
|
CREATE OPERATOR **> (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_all_int4gt
|
|
);
|
|
|
|
DROP OPERATOR *>=(_int4,int4);
|
|
CREATE OPERATOR *>= (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_int4ge
|
|
);
|
|
|
|
DROP OPERATOR **>=(_int4,int4);
|
|
CREATE OPERATOR **>= (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_all_int4ge
|
|
);
|
|
|
|
DROP OPERATOR *<(_int4,int4);
|
|
CREATE OPERATOR *< (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_int4lt
|
|
);
|
|
|
|
DROP OPERATOR **<(_int4,int4);
|
|
CREATE OPERATOR **< (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_all_int4lt
|
|
);
|
|
|
|
DROP OPERATOR *<=(_int4,int4);
|
|
CREATE OPERATOR *<= (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_int4le
|
|
);
|
|
|
|
DROP OPERATOR **<=(_int4,int4);
|
|
CREATE OPERATOR **<= (
|
|
LEFTARG=_int4,
|
|
RIGHTARG=int4,
|
|
PROCEDURE=array_all_int4le
|
|
);
|
|
|
|
-- define the array operators *=, **<> for type _oid (added tobias 1. 1999)
|
|
--
|
|
CREATE OR REPLACE FUNCTION array_oideq(_oid, oid)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_oidne(_oid, oid)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
DROP OPERATOR *=(_oid,oid);
|
|
CREATE OPERATOR *= (
|
|
LEFTARG=_oid,
|
|
RIGHTARG=oid,
|
|
PROCEDURE=array_oideq
|
|
);
|
|
|
|
DROP OPERATOR **<>(_oid,oid);
|
|
CREATE OPERATOR **<> (
|
|
LEFTARG=_oid,
|
|
RIGHTARG=oid,
|
|
PROCEDURE=array_all_oidne
|
|
);
|
|
|
|
-- define the array operators *=, **=, *<>, **<> for type _inet
|
|
|
|
CREATE OR REPLACE FUNCTION array_ineteq(_inet, inet)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_ineteq(_inet, inet)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_inetne(_inet, inet)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
CREATE OR REPLACE FUNCTION array_all_inetne(_inet, inet)
|
|
RETURNS bool
|
|
AS 'MODULE_PATHNAME'
|
|
LANGUAGE 'C' IMMUTABLE STRICT;
|
|
|
|
DROP OPERATOR *=(_inet,inet);
|
|
CREATE OPERATOR *= (
|
|
LEFTARG=_inet,
|
|
RIGHTARG=inet,
|
|
PROCEDURE=array_ineteq
|
|
);
|
|
|
|
DROP OPERATOR **=(_inet,inet);
|
|
CREATE OPERATOR **= (
|
|
LEFTARG=_inet,
|
|
RIGHTARG=inet,
|
|
PROCEDURE=array_all_ineteq
|
|
);
|
|
|
|
DROP OPERATOR *<>(_inet,inet);
|
|
CREATE OPERATOR *<> (
|
|
LEFTARG=_inet,
|
|
RIGHTARG=inet,
|
|
PROCEDURE=array_inetne
|
|
);
|
|
|
|
DROP OPERATOR **<>(_inet,inet);
|
|
CREATE OPERATOR **<> (
|
|
LEFTARG=_inet,
|
|
RIGHTARG=inet,
|
|
PROCEDURE=array_all_inetne
|
|
);
|