Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opVU2-0002C1-VM for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Oct 2022 14:09:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1opVU1-0003Bl-Ky for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Oct 2022 14:09:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opVU1-0003Bc-Aj for pgsql-hackers@lists.postgresql.org; Mon, 31 Oct 2022 14:09:45 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opVTx-0001Mo-LC for pgsql-hackers@lists.postgresql.org; Mon, 31 Oct 2022 14:09:44 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0280B5C0163; Mon, 31 Oct 2022 10:09:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 31 Oct 2022 10:09:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1667225378; x= 1667311778; bh=RF/h+w7Hjf9XcdfPPnQE5cAH07JKXGjPgN3dvtYx9b8=; b=i LgBW5l88j9ulO+6ZDKsff4w8TO5eZFJTkFOCURhOIcLH4qkXcebVJEia+sT+oJJp Jf/IomirK86qbQNDD6DaSVlRSPe0Gm6NI6scP1I3a80w6ErLU7IN6ub79MdwrfuQ Te+ksRWRnm76iYBkvwJBqEfU30u0XHl+f9NydU530gM1Vym83bIO0lOBDahOdhGf QWMqzRqS/JeBu+OBzhfSfjULJMlIwS4lgveLW7HyuWf7nZvd8NEmnIrHYiSyi55Q +SGPtd7p/4+3yMZ1el0BCxXme199IrhmiQUW21UNZsZDkSVkkxeri3JnPJdagTon CTEluExepizUxEeKjLfyg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrudefgdeitdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhephfejudeuleefheeutddu feetjeevgeeiieeujeeuheefkedttdeuieeiieethfevnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 31 Oct 2022 10:09:37 -0400 (EDT) Message-ID: Date: Mon, 31 Oct 2022 15:09:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: WIN32 pg_import_system_collations Content-Language: en-US To: =?UTF-8?Q?Juan_Jos=c3=a9_Santamar=c3=ada_Flecha?= Cc: Dmitry Koval , PostgreSQL Hackers References: <0050ec23-34d9-2765-9015-98c04f0e18ac@postgrespro.ru> <639e0abd-ea82-b751-bfba-5166a7a1b304@enterprisedb.com> <20220322010057.w7mzoahyi3jy5dyf@alap3.anarazel.de> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12.07.22 21:32, Juan José Santamaría Flecha wrote: > Please find attached a rebased version. I have split the patch into two > parts trying to make it easier to review, one with the code changes and > the other with the test. > > Other than that, there are minimal changes from the previous version to > the code due to the update of _WIN32_WINNT and enabling the test on cirrus. I'm not familiar with Windows, so I'm just looking at the overall structure of this patch. I think it pretty much makes sense. But we need to consider that this operates on the confluence of various different operating system interfaces that not all people will be familiar with, so we need to really get the documentation done well. Consider this function you are introducing: +/* + * Create a collation if the input locale is valid for so. + * Also keeps track of the number of valid locales and collations created. + */ +static int +CollationFromLocale(char *isolocale, char *localebuf, int *nvalid, + int *ncreated, int nspid) This declaration is incomprehensible without studying all the callers and the surrounding code. Start with the name: What does "collation from locale" mean? Does it make a collation? Does it convert one? Does it find one? There should be a verb in there. (I think in the context of this file, a lower case name would be more appropriate for a static function.) Then the arguments. The input arguments should be "const". All the arguments should be documented. What is "isolocale", what is "localebuf", how are they different? What is being counted by "valid" (collatons?, locales?), and what makes a thing valid and invalid? What is being "created"? What is nspid? What is the return value? Please make another pass over this. Also consider describing in the commit message what you are doing in more detail, including some of the things that have been discussed in this thread.