Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hibHX-0000Vz-RO for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jul 2019 09:10:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hibHV-0001ib-TM for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jul 2019 09:10:25 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hibHV-0001eu-Il for pgsql-hackers@lists.postgresql.org; Wed, 03 Jul 2019 09:10:25 +0000 Received: from ssl.nataraj.su ([195.54.209.170]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hibHP-0003Ek-HY for pgsql-hackers@lists.postgresql.org; Wed, 03 Jul 2019 09:10:25 +0000 Received: from x200m.localnet (unknown [176.59.20.60]) by ssl.nataraj.su (Postfix) with ESMTPSA id 702DB26C8BCD; Wed, 3 Jul 2019 12:10:18 +0300 (MSK) From: Nikolay Shaplov To: pgsql-hackers@lists.postgresql.org Cc: Alvaro Herrera , Tom Lane , Robert Haas , Nikita Glukhov , "pgsql-hackers@postgresql.org" Subject: Re: [PATCH][PROPOSAL] Add enum releation option type Date: Wed, 03 Jul 2019 12:10:08 +0300 Message-ID: <15941756.bfKRYTai5T@x200m> User-Agent: KMail/5.2.3 (Linux/4.9.0-8-amd64; KDE/5.28.0; x86_64; ; ) In-Reply-To: <20190701180628.GA17184@alvherre.pgsql> References: <20190701180628.GA17184@alvherre.pgsql> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =D0=92 =D0=BF=D0=B8=D1=81=D1=8C=D0=BC=D0=B5 =D0=BE=D1=82 =D0=BF=D0=BE=D0=BD= =D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 1 =D0=B8=D1=8E=D0=BB=D1= =8F 2019 =D0=B3. 14:06:28 MSK =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0= =B0=D1=82=D0=B5=D0=BB=D1=8C Alvaro=20 Herrera =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > It strikes me that the way to avoid sentence construction is to have > each enum reloption declare a string that it uses to list the values it > accepts. So for example we would have >=20 > +#define GIST_OPTION_BUFFERING_ENUM_DEF { \ > + { "on", GIST_OPTION_BUFFERING_ON }, \ > + { "off", GIST_OPTION_BUFFERING_OFF }, \ > + { "auto", GIST_OPTION_BUFFERING_AUTO }, \ > + { (const char *) NULL, 0 } \ > +} > + > + GistBufferingValidMsg =3D gettext_noop("Valid values are \"on\", \"off\= ", > and \"auto\"."); >=20 > I think that's the most contentious point on this patch at this point > (though I may be misremembering). I actually removed "and" from the list and let it be simple coma separated= =20 list ERROR: invalid value for "check_option" option = =20 DETAIL: Valid values are: "local", "cascaded". Now we can translate left part, and subst list to the right part errdetail("Valid values are: %s.", buf.data))); It is not that nice as before, but quite acceptable, as I see it. You do not see it that way?