Re: [PATCH] initdb: Treat empty -U argument as unset username

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [PATCH] initdb: Treat empty -U argument as unset username
Дата
Msg-id CAKFQuwaCPkb8=2_V3121Ei0MBrg02FLRNQbcAcyzCO3dAha=Gw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] initdb: Treat empty -U argument as unset username  (Jianghua Yang <yjhjstz@gmail.com>)
Ответы Re: [PATCH] initdb: Treat empty -U argument as unset username
Список pgsql-hackers
We try to stick with plain text and inline/bottom replies here.

On Tue, Jul 1, 2025 at 8:31 PM Jianghua Yang <yjhjstz@gmail.com> wrote:

git show 8e673801262c66af4a54837f63ff596407835c20


        effective_user = get_id();

-       if (strlen(username) == 0)

+       if (!username)

                username = effective_user;


The previous code already intended to treat a missing username as falling back to the system user. 
The check was changed from strlen(username) == 0 to !username, but this inadvertently stopped handling the empty-string case. This patch restores the original intent and makes the behavior consistent.


At this point I'd rather take advantage of this behaveing in the "doesn't work" category for the past 8 years, and thus all supported releases, and not change existing behavior (just improve the error message) rather than accept original intent.  Also, the amount of things it has to be consistent with is quite small and I'm pytr sure that some of those are also broken - encoding/pgdata/textsearch all exhibit the same pattern (xlog is the reverse so maybe ok...)

David J.








В списке pgsql-hackers по дате отправления: