Re: [PATCH] Add support function for containment operators

Поиск
Список
Период
Сортировка
От jian he
Тема Re: [PATCH] Add support function for containment operators
Дата
Msg-id CACJufxHHyaTMxRJB3ZepvtcnGJUqT-TAieGt6p=Zi70G6t5bqw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Add support function for containment operators  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: [PATCH] Add support function for containment operators  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-hackers
On Fri, Oct 20, 2023 at 12:01 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> On Fri, 2023-10-13 at 14:26 +0800, jian he wrote:
> > Collation problem seems solved.
>
> I didn't review your patch in detail, there is still a problem
> with my example:
>
>   CREATE TYPE textrange AS RANGE (
>      SUBTYPE = text,
>      SUBTYPE_OPCLASS = text_pattern_ops
>   );
>
>   CREATE TABLE tx (t text COLLATE "cs-CZ-x-icu");
>
>   INSERT INTO tx VALUES ('a'), ('c'), ('d'), ('ch');
>
>   SELECT * FROM tx WHERE t <@ textrange('a', 'd');
>
>    t
>   ════
>    a
>    c
>    ch
>   (3 rows)
>
> That was correct.
>
>   EXPLAIN SELECT * FROM tx WHERE t <@ textrange('a', 'd');
>
>                        QUERY PLAN
>   ════════════════════════════════════════════════════
>    Seq Scan on tx  (cost=0.00..30.40 rows=7 width=32)
>      Filter: ((t >= 'a'::text) AND (t < 'd'::text))
>   (2 rows)
>
> But that was weird.  The operators seem wrong.  Look at that

Thanks for pointing this out!

The problem is that TypeCacheEntry->rngelemtype typcaheentry don't
have the range's SUBTYPE_OPCLASS info.
So in find_simplified_clause, we need to get the range's
SUBTYPE_OPCLASS from the pg_catalog table.
Also in pg_range, column rngsubopc  is not null. so this should be fine.

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: CRC32C Parallel Computation Optimization on ARM
Следующее
От: zhihuifan1213@163.com
Дата:
Сообщение: Re: UniqueKey v2