Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qT58D-008LCb-EP for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 18:39:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qT58A-00B07H-NG for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Aug 2023 18:39:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qT58A-00B079-Ca for pgsql-hackers@lists.postgresql.org; Mon, 07 Aug 2023 18:39:02 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qT583-0014Na-E4 for pgsql-hackers@lists.postgresql.org; Mon, 07 Aug 2023 18:39:01 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-68706b39c4cso3323428b3a.2 for ; Mon, 07 Aug 2023 11:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691433534; x=1692038334; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DD/1sY9QhUA84u/v2VxX0lEkBl90eIKh3g0grUK1QXE=; b=PyQ2mEKCL1ebRiB5b17Khhl9mA29BWWHNimtIP1+4dULiVLYCoQrmWYGlFWGnyVaTp +ppwpyQHcFhgoqPTj+Qip/fv6n4LpWhfJbNtEBEEmZqD1jdMcqbdNDRj+LhYEvh/Vbtc DcjeTGd/N+fNr8gHgmG0PupFn0B5G5vnFPQZNQI4v3BOZ7FXUyYuoWTeBYmbXLjs8AqZ 86sjuubutRwqlXAcurxu+aYm9f1CM48IW6HdJYbuyGMz1mHXFTh3/Z4zj8xfQXw73Fy+ CPnK8owpvFQ4VaiRbIaE6uij8aey9+lWU+4RpfpdnRbsAeQk2G67CgNQ5ZDrmnJNHf2V mJ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691433534; x=1692038334; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DD/1sY9QhUA84u/v2VxX0lEkBl90eIKh3g0grUK1QXE=; b=XYh/YFVNAq4iQOfnRnlzL7rB1/5zYSVU1wlwp+w6iFdoGwZp17rlLdIRibkeJLkZHz wEWIlK3/3Z3QiGvqaPfN2ElXITW3eUlgSueHkBKCV8LGo0woV0xn12DaXcS1+LDRwmHl A2MSP8aDijbPcPYidgOC1ocyWrCL4mwtdXNdtTgWNgk6GJtCXECro1x7QUdKjzCfQtND UyDKGOWlP+r77MBDeuyXs2jZCNcLfBl2c75pSy3r1ErJKwKiJhFvvTf5xj8n875jRDSx Iny0bttE3g/e/s42A+1JRznurn3TxDZpqviUZTQa9Fkaue0bOqnUnxUzWptkTmTowsJ0 VixQ== X-Gm-Message-State: AOJu0YwhRZHdulYdYEIb7hJ2Fezp8BCzDYfs8zc3LbqqgGDxWRm7sEBc njVTENIjLy8OCY3QcnW0BfU= X-Google-Smtp-Source: AGHT+IHEm0llB2cwUqc5/CXC98ESLMn7HV9pr+NAx4czmLPJUI6ElduXFg2hW5t1M+dFeXXD/NAZZg== X-Received: by 2002:a05:6a00:1501:b0:675:ef91:7922 with SMTP id q1-20020a056a00150100b00675ef917922mr9879624pfu.4.1691433534291; Mon, 07 Aug 2023 11:38:54 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id k24-20020aa790d8000000b006829b28b393sm6420371pfk.199.2023.08.07.11.38.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 11:38:53 -0700 (PDT) Date: Mon, 7 Aug 2023 11:38:49 -0700 From: Nathan Bossart To: Tom Lane Cc: Robert Haas , Dave Cramer , Alvaro Herrera , Peter Smith , Tatsuo Ishii , pgsql-hackers@lists.postgresql.org Subject: Re: Using defines for protocol characters Message-ID: <20230807183849.GA1244255@nathanxps13> References: <20230807091044.jjgsl2rgheazaung@alvherre.pgsql> <838284.1691432698@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <838284.1691432698@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Aug 07, 2023 at 02:24:58PM -0400, Tom Lane wrote: > Robert Haas writes: >> IMHO, the correspondence between the names in the patch and the >> traditional names in the documentation could be stronger. For example, >> the documentation mentions EmptyQueryResponse and >> NegotiateProtocolVersion, but in this patch those become >> PQMSG_RESP_NEGOTIATE_PROTOCOL and PQMSG_RESP_EMPTY_QUERY. I think we >> could consider directly using the names from the documentation, right >> down to capitalization, perhaps with a prefix, but I'm also totally >> fine with this use of uppercase letters and underscores. But why not >> do a strict translation, like EmptyQueryResponse -> >> PQMSG_EMPTY_QUERY_RESPONSE, NegotiateProtocolVersion -> >> PQMSG_NEGOTIATE_PROTOCOL_VERSION? To me at least, the current patch is >> inventing new and slightly different names for things that already >> have names... > > +1. For ease of greppability, maybe even PQMSG_EmptyQueryResponse > and so on? Then one grep would find both uses of the constants and > code/docs references. Not sure if the prefix should be all-caps or > not if we go this way. +1 for Tom's suggestion. I have no strong opinion about the prefix, but I do think easing greppability is worthwhile. As mentioned earlier [0], I think we should also consider putting the definitions in pqcomm.h. [0] https://postgr.es/m/20230803185356.GA1144430%40nathanxps13 -- Nathan Bossart Amazon Web Services: https://aws.amazon.com