Re: partition tree inspection functions - Mailing list pgsql-hackers

From Amit Langote
Subject Re: partition tree inspection functions
Date
Msg-id e12ff710-dcf5-18ff-b4a4-cc42432d84c4@lab.ntt.co.jp
Whole thread Raw
In response to Re: partition tree inspection functions  (Jesper Pedersen <jesper.pedersen@redhat.com>)
Responses Re: partition tree inspection functions  (Jesper Pedersen <jesper.pedersen@redhat.com>)
List pgsql-hackers
Thanks for the review, Jesper.

On 2018/07/18 23:35, Jesper Pedersen wrote:
> On 06/28/2018 01:49 AM, Amit Langote wrote:
>> OK, I've added an example below the table of functions added by the patch.
>>
>> Attached updated patch.
>>
> 
> You forgot to remove the test output in create_table.out, so check-world
> is failing.

Oops, I'd noticed that but forgotten to post an updated patch.

Fixed.

> In pg_partition_parent
> 
> +    else
> +    /* Not a partition, return NULL. */
> +        PG_RETURN_NULL();
> 
> I would just remove the "else" such that PG_RETURN_NULL() is fall-through.

OK, done.

> I think pg_partition_tree_tables should have an option to exclude the
> table that is being queried from the result (bool include_self).

Doesn't sound too bad, so added include_self.

> Maybe a function like pg_partition_number_of_partitions() could be of
> benefit to count the number of actual partitions in a tree. Especially
> useful in complex scenarios,
> 
>  select pg_partition_number_of_partitions('p') as number;
> 
>    number
>  ---------
>   4
>  (1 row)

Okay, adding one more function at this point may not be asking for too
much.  Although, select count(*) from pg_partition_tree_tables('p') would
give you the count, a special function seems nice.

> New status: WfA

Attached updated patch.

Thanks,
Amit

Attachment

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: partition tree inspection functions
Next
From: Ashutosh Bapat
Date:
Subject: Re: de-deduplicate code in DML execution hooks in postgres_fdw