Re: Nondeterministic collations vs. text_pattern_ops

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Nondeterministic collations vs. text_pattern_ops
Date: 2019-09-18 12:31:39
Message-ID: c7e57eaf-5d7f-22b6-6f48-85580889de8d@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-09-17 17:17, Tom Lane wrote:
> My recommendation is to get rid of the run-time checks and instead
> put a hack like this into DefineIndex or some minion thereof:
>
> if ((opclass == TEXT_PATTERN_BTREE_CLASS_OID ||
> opclass == VARCHAR_PATTERN_BTREE_CLASS_OID ||
> opclass == BPCHAR_PATTERN_BTREE_CLASS_OID) &&
> !get_collation_isdeterministic(collid))
> ereport(ERROR, ...);

Here is a draft patch.

It will require a catversion change because those operator classes don't
have assigned OIDs so far.

The comment block I just moved over for the time being. It should
probably be rephrased a bit.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v1-0001-Prohibit-creating-text_pattern_ops-indexes-with-n.patch text/plain 10.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexey Kondratov 2019-09-18 12:46:20 Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly
Previous Message Ahsan Hadi 2019-09-18 12:29:52 Re: enhance SPI to support EXECUTE commands