Re: partitioning

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: partitioning
Дата
Msg-id CAApHDvoE2C=hUmAR_6a7kUE8hfvgxcK-b1ujZG+51YTAuyfZ6g@mail.gmail.com
обсуждение исходный текст
Ответ на partitioning  (Torsten Förtsch <tfoertsch123@gmail.com>)
Список pgsql-general
On Tue, 24 Oct 2023 at 10:39, Torsten Förtsch <tfoertsch123@gmail.com> wrote:
> Then I added this constraint to the small table:
>
> ALTER TABLE original_small_table
> ADD CONSTRAINT partition_boundaries
> CHECK((false, '-infinity')<=(is_sold, purchase_time)
>   AND (is_sold, purchase_time)<(false, 'infinity'))
>   NOT VALID;
>
> And validated it.
>
> When this is being attached as a partition, I still can see the process is reading the entire table.

I'm not seeing any handling of RowCompareExpr in predtest.c, so it
appears your row comparisons can't be used to prove that the CHECK
constraint implies the partition constraint.

> What am I missing? What should the check constraint look like in my case to match the partition constraint?

The following should work:

ALTER TABLE original_small_table ADD CONSTRAINT partition_boundaries
CHECK(not is_sold and purchase_time >= '-infinity' and purchase_time <
'infinity');

David



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

Предыдущее
От: Ron
Дата:
Сообщение: Re: setting up streaming replication
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: psql _ and \e -- what does clearing the query buffer actually do?