> On 2 Jul 2025, at 15:52, Jianghua Yang <yjhj...@gmail.com> wrote: > > Hi hackers, > > Based on the suggestion that we should explicitly reject empty usernames > instead of silently falling back, I’ve updated the patch accordingly. > > ### Changes in v2: > > - `initdb` now errors out immediately if the `-U` or `--username` argument is > an empty string. > - The error message is: > > superuser name must not be empty > > - A regression test is added to `src/bin/initdb/t/001_initdb.pl` to verify > that the case `initdb -U ''` fails as expected. > > This approach avoids any ambiguity about whether an empty username is valid, > and fails early with a clear message. It also brings consistency with > existing checks, such as the one disallowing superuser names starting with > `pg_`. > > Let me know if this looks acceptable or if further refinement is needed.
+ pg_log_error("superuser name must not be empty"); + exit(1); I would prefer pg_fatal() for this. -- Daniel Gustafsson