Re: COLLATE: Hash partition vs UPDATE

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: COLLATE: Hash partition vs UPDATE
Дата
Msg-id b462ff0c-a846-dce6-b0a7-ab1397e73b98@lab.ntt.co.jp
обсуждение исходный текст
Ответ на COLLATE: Hash partition vs UPDATE  (Jesper Pedersen <jesper.pedersen@redhat.com>)
Ответы Re: COLLATE: Hash partition vs UPDATE  (Jesper Pedersen <jesper.pedersen@redhat.com>)
Список pgsql-hackers
Hi Jesper,

On 2019/04/09 1:33, Jesper Pedersen wrote:
> Hi,
> 
> The following case
> 
> -- test.sql --
> CREATE TABLE test (a text PRIMARY KEY, b text) PARTITION BY HASH (a);
> CREATE TABLE test_p0 PARTITION OF test FOR VALUES WITH (MODULUS 2,
> REMAINDER 0);
> CREATE TABLE test_p1 PARTITION OF test FOR VALUES WITH (MODULUS 2,
> REMAINDER 1);
> -- CREATE INDEX idx_test_b ON test USING HASH (b);
> 
> INSERT INTO test VALUES ('aaaa', 'aaaa');
> 
> -- Regression
> UPDATE test SET b = 'bbbb' WHERE a = 'aaaa';
> -- test.sql --
> 
> fails on master, which includes [1], with
> 
> 
> psql:test.sql:9: ERROR:  could not determine which collation to use for
> string hashing
> HINT:  Use the COLLATE clause to set the collation explicitly.
> 
> 
> It passes on 11.x.

Thanks for the report.

This seems to broken since the following commit (I see you already cc'd
Peter):

commit 5e1963fb764e9cc092e0f7b58b28985c311431d9
Author: Peter Eisentraut <peter@eisentraut.org>
Date:   Fri Mar 22 12:09:32 2019 +0100

    Collations with nondeterministic comparison


As of this commit, hashing functions hashtext() and hashtextextended()
require a valid collation to be passed in.  ISTM,
satisfies_hash_partition() that's called by hash partition constraint
checking should have been changed to use FunctionCall2Coll() interface to
account for the requirements of the above commit.  I see that it did that
for compute_partition_hash_value(), which is used by hash partition tuple
routing.  That also seems to be covered by regression tests, but there are
no tests that cover satisfies_hash_partition().

Attached patch is an attempt to fix this.  I've also added Amul Sul who
can maybe comment on the satisfies_hash_partition() changes.

BTW, it seems we don't need to back-patch this to PG 11 which introduced
hash partitioning, because text hashing functions don't need collation
there, right?

Thanks,
Amit

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: [PATCH v20] GSSAPI encryption support
Следующее
От: Amit Langote
Дата:
Сообщение: Re: hyrax vs. RelationBuildPartitionDesc