Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fAmiz-0004Ry-8D for pgsql-committers@arkaria.postgresql.org; Tue, 24 Apr 2018 01:26:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fAmiw-0004yZ-GG for pgsql-committers@arkaria.postgresql.org; Tue, 24 Apr 2018 01:26:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fAmiw-0004yQ-Aw for pgsql-committers@lists.postgresql.org; Tue, 24 Apr 2018 01:26:26 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fAmio-0006oQ-G8 for pgsql-committers@lists.postgresql.org; Tue, 24 Apr 2018 01:26:25 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w3O1Q9uJ009998; Tue, 24 Apr 2018 10:26:09 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 31131638720; Tue, 24 Apr 2018 10:26:09 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 25D8C638621; Tue, 24 Apr 2018 10:26:09 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 09AB6400B50; Tue, 24 Apr 2018 10:26:09 +0900 (JST) Subject: Re: pgsql: Remove useless default clause in switch References: <20180424012042.GD1570@paquier.xyz> From: Amit Langote Message-ID: <55ab8ed8-818f-5981-66da-80483282789f@lab.ntt.co.jp> Date: Tue, 24 Apr 2018 10:25:59 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180424012042.GD1570@paquier.xyz> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Michael Paquier , David Rowley Cc: Alvaro Herrera , pgsql-committers@lists.postgresql.org X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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