On Wed, Jul 2, 2025 at 12:01 AM David G. Johnston
<david.g.johns...@gmail.com> wrote:
> On Tue, Jul 1, 2025 at 8:31 PM Jianghua Yang <yjhj...@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...)
>

FWIW, I tend to agree with David; I feel like if a user passes in -U,
there was probably a reason, and a good error message would be more
useful in clarifying things rather than blindly pushing forward with
potentially the wrong thing.


Robert Treat
https://xzilla.net


Reply via email to