Re: [HACKERS] Adding support for Default partition in partitioning - Mailing list pgsql-hackers

From Beena Emerson
Subject Re: [HACKERS] Adding support for Default partition in partitioning
Date
Msg-id CAOG9ApEHQ+LurZCyNOEyfGfn60RRsbvwzm-G6pM2WOJONEuBPg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Adding support for Default partition in partitioning  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: [HACKERS] Adding support for Default partition in partitioning  (Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>)
List pgsql-hackers
On Wed, May 31, 2017 at 8:13 AM, Amit Langote
<Langote_Amit_f8@lab.ntt.co.jp> wrote:
> On 2017/05/31 9:33, Amit Langote wrote:
>
>
> In get_rule_expr():
>
>                      case PARTITION_STRATEGY_LIST:
>                          Assert(spec->listdatums != NIL);
>
> +                        /*
> +                         * If the boundspec is of Default partition, it does
> +                         * not have list of datums, but has only one node to
> +                         * indicate its a default partition.
> +                         */
> +                        if (isDefaultPartitionBound(
> +                                        (Node *) linitial(spec->listdatums)))
> +                        {
> +                            appendStringInfoString(buf, "DEFAULT");
> +                            break;
> +                        }
> +
>
> How about adding this part before the switch (key->strategy)?  That way,
> we won't have to come back and add this again when we add range default
> partitions.

I think it is best that we add a bool is_default to PartitionBoundSpec
and then have a general check for both list and range. Though
listdatums, upperdatums and lowerdatums are set to default for a
DEFAULt partition, it does not seem proper that we check listdatums
for range as well.




-- 

Beena Emerson

EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [HACKERS] pg_config --version-num
Next
From: "David G. Johnston"
Date:
Subject: Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump