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

From Jesper Pedersen
Subject Re: partition tree inspection functions
Date
Msg-id dfd06fa1-ddb0-3dda-fa2f-8651fc52a174@redhat.com
Whole thread Raw
In response to Re: partition tree inspection functions  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: partition tree inspection functions  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
Hi Amit,

On 07/26/2018 10:33 PM, Amit Langote wrote:
> Optional parameter sounds good, so made it get_partition_level(regclass [
> , regclass ]) in the updated patch.  Although, adding that argument is not
> without possible surprises its result might evoke.  Like, what happens if
> you try to find the level of the root table by passing a leaf partition
> oid for the root table argument, or pass a totally unrelated table for the
> root table argument.  For now, I've made the function return 0 for such cases.
> 

As 0 is a valid return value for root nodes I think we should use -1 
instead for these cases.

Otherwise looks good.

Best regards,
  Jesper


pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: pgbench - very minor bug fix on hash() missing argument
Next
From: Alexander Kuzmenkov
Date:
Subject: Re: Removing unneeded self joins