Re: POC: contrib/unaccent as IMMUTABLE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Petru Ghita <petru(dot)ghita(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: POC: contrib/unaccent as IMMUTABLE
Date: 2020-10-03 15:37:17
Message-ID: 1353397.1601739437@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alexander Korotkov <aekorotkov(at)gmail(dot)com> writes:
> I personally don't have an exact understanding of how strict we are
> about marking functions immutable. For example,
> to_tsvector(regconfig, text) is immutable.

Yeah. This is in fact wrong, because a TS configuration can *very*
easily be changed by the user. We held our noses and did it anyway
to allow tsvector results to be stored in indexes, figuring that
(a) we'd put it on the user's head to reindex when necessary, and
(b) in most situations, small changes in a TS configuration don't
make an old tsvector index unusable --- at worst, some searches
will fail that should have succeeded. (I'm not entirely sure that
I believe (b), but that was the argument that was advanced.)

I do not think we'd accept such a compromise if it were put forward
today. The project's standards for such things have tightened over
time, as evidenced by the work that's going towards collation
change detection.

It's also worth noting that the consequences of an out-of-date
index for unaccent seem likely to be worse than they are for
tsvectors. It's not hard to imagine somebody making a unique
index on an unaccent result, and then setting themselves up for
dump/reload failures by changing the unaccent rules. Nobody
builds unique indexes on tsvectors.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-10-03 15:55:16 Re: buildfarm animal shoveler failing with "Illegal instruction"
Previous Message Tom Lane 2020-10-03 15:19:07 Re: POC: contrib/unaccent as IMMUTABLE