[PATCH] Add citext_pattern_ops to citext contrib module

From: Alexey Chernyshov <a(dot)chernyshov(at)postgrespro(dot)ru>
To: PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Add citext_pattern_ops to citext contrib module
Date: 2017-07-18 12:18:25
Message-ID: d868ae6c-501c-a17c-c01b-f531d646172d@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

The attached patch introduces citext_pattern_ops for citext extension
type like text_pattern_ops for text type. Here are operators ~<~, ~<=~,
~>~, ~>=~ combined into citext_pattern_ops operator class. These
operators simply compare underlying citext values as C strings with
memcmp() function. This operator class isn’t supported by B-Tree index
yet, but it is a first step to do it.

Patch includes regression tests and is applicable to the latest commit

The problem of citext support for LIKE operator with B-Tree index was
mentioned in [1]. Briefly, the planner doesn’t use B-Tree index for
queries text_col LIKE ‘abc%’. I’d like to investigate how to improve it
and make another patch. I think the start point is
match_special_index_operator() function which doesn’t support custom
types. I would appreciate hearing your opinion on this.

1. https://www.postgresql.org/message-id/3924.1480351187%40sss.pgh.pa.us

Alexey Chernyshov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
citext_pattern_ops-v1.patch text/x-patch 53.2 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-07-18 12:40:37 Re: merge psql ef/ev sf/sv handling functions
Previous Message Victor Drobny 2017-07-18 12:10:24 Re: merge psql ef/ev sf/sv handling functions