Hello. At Tue, 18 Dec 2018 17:13:08 -0800, Andres Freund <and...@anarazel.de> wrote in <20181219011308.mopzyvc73nwjz...@alap3.anarazel.de> > Hi, > > Right now there's no easy way to use the compiler to ensure that all > places that need to deal with all kinds of relkinds check a new > relkind. I think we should make that easier by moving RELKIND_* to an > enum, with the existing letters as the value.
I feel the same pain and I had thought of a kind of that before. > Obviously we cannot really do that for FormData_pg_class.relkind, but > switch() statements can easily cast that to RelationRelkind (or whatever > we name it). > > Does anybody see a reason not to do so? I think we cannot use enums having base-type, so it will work unless we forget the cast within switch(). However, I don't think it is not a reason not to do so. switch ((RelationRelkind) rel->rd_rel->relkind) { ... } char is compatible with integer under our usage there. FWIW I don't mind explict assignments in the enum definition since we already do the similar thing there. regards. -- Kyotaro Horiguchi NTT Open Source Software Center