Re: WIN32 pg_import_system_collations

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
Cc: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: WIN32 pg_import_system_collations
Date: 2022-10-31 14:09:36
Message-ID: f0ca9ad8-67f9-6d18-ec15-9525f864fa12@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2022-10-31 14:12:22 Re: Prefetch the next tuple's memory during seqscans
Previous Message Aleksander Alekseev 2022-10-31 13:51:23 Re: Commitfest documentation