pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Michael Paquier <michael@paquier.xyz>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove useless default clause in switch
Date: Tue, 24 Apr 2018 10:25:59 +0900
Message-ID: <55ab8ed8-818f-5981-66da-80483282789f@lab.ntt.co.jp> (raw)
In-Reply-To: <20180424012042.GD1570@paquier.xyz>
References: <E1fAd8s-0003wZ-AV@gemulon.postgresql.org>
	<CAKJS1f9vS7W0MDp-DJ0ixg3bMhJo0vdU-vzjZR3CumvtaTP9cg@mail.gmail.com>
	<20180424012042.GD1570@paquier.xyz>

On 2018/04/24 10:20, Michael Paquier wrote:
> On Tue, Apr 24, 2018 at 12:27:27PM +1200, David Rowley wrote:
>> I always thought that when all options were covered that we generally
>> kept a default just in case someone added another enum and forgot to
>> update the code.
>>
>> I know generally those are with elog ERRORs but both would be designed
>> to alert a programmer, just at different times.
> 
> The advantage with what Alvaro has done is that you get warning at
> compilation time, so it is much more helpful for developers when
> adding an option because they need to think about code paths where the
> warning comes from.

+1

>> There are other examples in that file with the switch
>> (part_scheme->strategy), these are not using enums. I'd have to assume
>> that these must be different because of that.
> 
> Those apply to PARTITION_STRATEGY_LIST and such, which are not defined
> based on an enumeration but using their catalog interpretation, so this
> assumption cannot apply.  The same applies for BTLessEqualStrategyNumber
> & friends which have their own definition.
> 
> You are right for what's in perform_pruning_combine_step though, so the
> attached could also be applied.

Thanks for spotting that one.

Regards,
Amit





view thread (8+ messages)  latest in thread

Message-ID: <55ab8ed8-818f-5981-66da-80483282789f@lab.ntt.co.jp>
Permalink:  ../55ab8ed8-818f-5981-66da-80483282789f@lab.ntt.co.jp/
Also on:    postgresql.org/message-id/55ab8ed8-818f-5981-66da-80483282789f@lab.ntt.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: Langote_Amit_f8@lab.ntt.co.jp, michael@paquier.xyz, david.rowley@2ndquadrant.com, alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Remove useless default clause in switch
  In-Reply-To: <55ab8ed8-818f-5981-66da-80483282789f@lab.ntt.co.jp>
  References: <E1fAd8s-0003wZ-AV@gemulon.postgresql.org> <CAKJS1f9vS7W0MDp-DJ0ixg3bMhJo0vdU-vzjZR3CumvtaTP9cg@mail.gmail.com> <20180424012042.GD1570@paquier.xyz> <55ab8ed8-818f-5981-66da-80483282789f@lab.ntt.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox