Re: Boolean partitions syntax

Поиск
Список
Период
Сортировка
От Jonathan S. Katz
Тема Re: Boolean partitions syntax
Дата
Msg-id 82E99A1B-9C69-4A2B-9A2E-8438EE591FB8@excoventures.com
обсуждение исходный текст
Ответ на Re: Boolean partitions syntax  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Список pgsql-hackers
Hi,

On Apr 12, 2018, at 12:12 AM, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote:

Hello.

At Wed, 11 Apr 2018 09:43:37 -0400, "Jonathan S. Katz" <jonathan.katz@excoventures.com> wrote in <EFEBA03D-EFFC-46E2-A0F7-41D00487066B@excoventures.com>
               case EXPR_KIND_PARTITION_BOUNDS:
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
..
2 errors generated.

The attached patch fixes the error.

Sorry for the silly mistake.

I ran the following cases:

Case #1: My Original Test Case

CREATE TABLE records (
    id int GENERATED BY DEFAULT AS IDENTITY NOT NULL,
    record_date date NOT NULL,
    record_text text,
    archived bool NOT NULL DEFAULT FALSE
) PARTITION BY LIST(archived);

CREATE TABLE records_archive
PARTITION OF records
FOR VALUES IN (TRUE);

CREATE TABLE records_active
PARTITION OF records
FOR VALUES IN (FALSE);

Everything created like a charm.

Case #2: random()

CREATE TABLE oddity (
    id int GENERATED BY DEFAULT AS IDENTITY NOT NULL,
    random_filter int
) PARTITION BY LIST(random_filter);

CREATE TABLE oddity_random
PARTITION OF oddity
FOR VALUES IN ((random() * 100)::int);

I did a \d+ on oddity and:

partitions=# \d+ oddity
(truncated)
Partition key: LIST (random_filter)
Partitions: oddity_random FOR VALUES IN (19)

So this appears to behave as described above.

Attached is the patch with the fix for the build.  This is the first time I’m attaching
a patch for the core server, so apologizes if I missed up the formatting.

Thank you for verification and the revised patch. The format is
fine and the fix is correct but I noticed that I forgot to remove
plural S's from error messages. The attached is the version with
the fix.

I applied the new version of the patch and ran through the above scenarios
again.  Everything behaved as expected from a user standpoint.

Thanks,

Jonathan

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

Предыдущее
От: Darafei "Komяpa" Praliaskouski
Дата:
Сообщение: Re: psql leaks memory on query cancellation
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: crash with sql language partition support function