.. _citext:

======
citext
======


插件citext简介
----------------------

citext定义了citext类型以及其相关函数。

- 插件名为citext

- 插件版本 V1.0


插件citext加载方式
----------------------

使用时需要create extension citext。

示例：

.. code::

	create extension citext;


插件citext参数配置
-------------------------

无需配置任何参数


插件citext使用方法
-------------------------


regexp_matches
^^^^^^^^^^^^^^^^

regexp_matches-获得匹配的模式串集合

**语法**

.. code::

	regexp_matches(c1 citext, c2 citext ) RETURNS SETOF TEXT[]。
	regexp_matches(c1 citext, c2 citext, t1 text ) RETURNS SETOF TEXT[]。

**描述**

regexp_matches会返回匹配的模式串集合。

**参数**

- c1 待匹配的字符串
- c2 正则表达式
- t1 匹配的模式

**返回值**

返回计算完成的特定的日期类型值。

**注解**

regexp_matches(c1 citext, c2 citext ) 相当于 regexp_matches(c1 citext, c2 citext, t1 text ) 的t1的值为'i'。
t1的参数为'c'代表大小写敏感,'g'允许输出多行等。

**示例**

.. code::

	SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)') = ARRAY[ 'bar', 'beque' ] AS t;
	 t 
	---
	 t
	(1 row)

	SELECT regexp_matches('foobarbequebaz'::citext, '(BAR)(BEQUE)'::citext) = ARRAY[ 'bar', 'beque' ] AS t;
	 t 
	---
	 t
	(1 row)

citext
^^^^^^^^

citext-将输入转换为citext类型并输出

**语法**

.. code::

	citext(bpchar) RETURNS citext。
	citext(boolean) RETURNS citext。
	citext(inet) RETURNS citext。

**示例**

.. code::

	select citext('abc'bpchar);
	 citext
	--------
	 abc
	(1 行记录)


citext_eq
^^^^^^^^^^^

citext_eq-对两个输入的citext类型进行比较，相等返回true，不相等返回false。。

**语法**

.. code::

	citext_eq(citext, citext) RETURNS bool。

**示例**

.. code::

	select citext_eq('as','ab');
	 citext_eq
	-----------
	 f
	(1 行记录)


citext_ne(citext, citext)
^^^^^^^^^^^^^^^^^^^^^^^^^^^

与citext_ne的功能相反


citext_hash
^^^^^^^^^^^^^

citext_hash-将输入的citext转换为hash值并输出。

**语法**

.. code::

	citext_hash(citext) RETURNS int4。

**示例**

.. code::

	select citext_hash('ab');
	 citext_hash
	-------------
	  1718550461
	(1 行记录)


支持两个citext类型≥,≤,>,<,＝,!=等操作符的操作
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**示例**

.. code::

	TEST=# select 'abd'::citext != 'abs'::citext;
	 ?column?
	----------
	t
	(1 行记录)

	TEST=# select 'abd'::citext = 'abs'::citext;
	 ?column?
	----------
	f
	(1 行记录)

	TEST=# select 'abd'::citext > 'abs'::citext;
	 ?column?
	----------
	f
	(1 行记录)

	TEST=# select 'abd'::citext >= 'abs'::citext;
	 ?column?
	----------
	f
	(1 行记录)

	TEST=# select 'abd'::citext >= 'abd'::citext;
	 ?column?
	----------
	t
	(1 行记录)


插件citext卸载方法
---------------------

不需要citext插件只需要卸载插件即可。

示例：

.. code::

	drop extension citext;


插件citext升级方法
-------------------------

citext扩展插件通常随KingbaseES安装包一并升级。通常情况下用户无法单独升级插件。
