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. > 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. -- Michael
diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c index f8844ef2eb..cbbb4c1827 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -2950,10 +2950,6 @@ perform_pruning_combine_step(PartitionPruneContext *context, } } break; - - default: - elog(ERROR, "invalid pruning combine op: %d", - (int) cstep->combineOp); } return result;
signature.asc
Description: PGP signature
