createuser doesn't tell default settings for some options

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: createuser doesn't tell default settings for some options
Date: 2022-08-10 06:12:43
Message-ID: 20220810.151243.1073197628358749087.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(I suppose this is a pg15 issue)

createuser --help shows the following help text.

> --bypassrls role can bypass row-level security (RLS) policy
> --no-bypassrls role cannot bypass row-level security (RLS) policy
> --replication role can initiate replication
> --no-replication role cannot initiate replication

For other options the text tells which one is the default, which I
think the two options also should have the same.

> -r, --createrole role can create new roles
> -R, --no-createrole role cannot create roles (default)

In correspondence, it seems to me that the command should explicitly
place the default value (of the command's own) in generated SQL
command even if the corresponding command line options are omitted, as
createrole and so do. (attached first)

The interacitive mode doesn't cover all options, but I'm not sure what
we should do to the mode since I don't have a clear idea of how the
mode is used. In the attached only --bypassrls is arbirarily added.
The remaining options omitted in the interactive mode are: password,
valid-until, role, member and replication. (attached second)

The ternary options are checked against decimal 0, but it should use
TRI_DEFAULT instead. (attached third)

I tempted to check no ternary options remains set to TRY_DEFAULT
before generating SQL command, but I didn't that in the attached.

What do you think about this?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Fix-handling-of-default-option-values-in-createuser.patch text/x-patch 1.9 KB
0002-Add-bypassrls-to-interactive-mode-in-createuser.patch text/x-patch 838 bytes
0003-Use-ternary-value-against-ternary-variables.patch text/x-patch 1.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2022-08-10 06:33:49 Re: Reducing the chunk header sizes on all memory context types
Previous Message Thomas Munro 2022-08-10 05:36:41 Re: hash_xlog_split_allocate_page: failed to acquire cleanup lock