Re: pgsql: Remove useless default clause in switch - Mailing list pgsql-committers

From David Rowley
Subject Re: pgsql: Remove useless default clause in switch
Date
Msg-id CAKJS1f9vS7W0MDp-DJ0ixg3bMhJo0vdU-vzjZR3CumvtaTP9cg@mail.gmail.com
Whole thread Raw
In response to pgsql: Remove useless default clause in switch  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: pgsql: Remove useless default clause in switch  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pgsql: Remove useless default clause in switch  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: pgsql: Remove useless default clause in switch  (Michael Paquier <michael@paquier.xyz>)
Re: pgsql: Remove useless default clause in switch  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-committers
On 24 April 2018 at 03:12, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Remove useless default clause in switch
>
> The switch covers all values of the enum driver variable, so having a
> default: clause is useless, even if it's only to do Assert(false).

Just for my own understanding:

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.

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.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: Add GUC enable_partition_pruning
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Remove useless default clause in switch