Re: Boolean partitions syntax

From: "Jonathan S(dot) Katz" <jonathan(dot)katz(at)excoventures(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp, tgl(at)sss(dot)pgh(dot)pa(dot)us, david(dot)rowley(at)2ndquadrant(dot)com, robertmhaas(at)gmail(dot)com, peter(dot)eisentraut(at)2ndquadrant(dot)com, Stephen Frost <sfrost(at)snowman(dot)net>, hornschnorter(at)gmail(dot)com, dilipbalaut(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Boolean partitions syntax
Date: 2018-04-12 12:51:24
Message-ID: 82E99A1B-9C69-4A2B-9A2E-8438EE591FB8@excoventures.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> On Apr 12, 2018, at 12:12 AM, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>
> Hello.
>
> At Wed, 11 Apr 2018 09:43:37 -0400, "Jonathan S. Katz" <jonathan(dot)katz(at)excoventures(dot)com <mailto:jonathan(dot)katz(at)excoventures(dot)com>> wrote in <EFEBA03D-EFFC-46E2-A0F7-41D00487066B(at)excoventures(dot)com <mailto:EFEBA03D-EFFC-46E2-A0F7-41D00487066B(at)excoventures(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-04-12 12:55:15 Re: crash with sql language partition support function
Previous Message Darafei Komяpa Praliaskouski 2018-04-12 12:37:54 Re: psql leaks memory on query cancellation