=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@kurilemu.de> writes:
> There have been mentions of turning Form_pg_class->relkind into an enum,
> so that we can have compilers provide some more help with
> switch(relkind) blocks. Here's a quick experiment with that.
> ...
> 0003 is the backend-side change. This looks generally reasonable,
> though I'm annoyed that I couldn't find a way to coerce the compiler
> into telling me if I had missed some spot.
Yeah. On the whole I'm dubious that this is worth the code churn,
because I doubt that it will move the needle at all on getting
better compiler warnings. One reason why I think that is that
I don't think it's okay to assume that what comes off of disk
for the contents of pg_class.relkind is necessarily one of the
valid values: catalog corruption would break that assumption.
So even in places where it's reasonable to list every RELKIND_
value in a switch (and in many of them it looks like that would
be tedium), we'd still need to cater for a default: clause.
And then we'd get no warnings, so what have we gained?
regards, tom lane