Thread: createuser doesn't tell default settings for some options
(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
> On 10 Aug 2022, at 08:12, Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote: > > (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. Agreed. For --no-replication the docs in createuser.sgml should fixed to include a "This is the default" sentence like the others have as well. > 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) I'm not convinced that we should add more to the interactive mode, it's IMO mostly a backwards compat option for ancient (pre-9.2) createuser where this was automatically done. Back then we had this in the documentation which has since been removed: "You will be prompted for a name and other missing information if it is not specified on the command line." > The ternary options are checked against decimal 0, but it should use > TRI_DEFAULT instead. (attached third) Agreed, nice catch. -- Daniel Gustafsson https://vmware.com/
> On 10 Aug 2022, at 10:28, Daniel Gustafsson <daniel@yesql.se> wrote: > >> On 10 Aug 2022, at 08:12, Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote: >> >> (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. > > Agreed. For --no-replication the docs in createuser.sgml should fixed to > include a "This is the default" sentence like the others have as well. >> The ternary options are checked against decimal 0, but it should use >> TRI_DEFAULT instead. (attached third) > > Agreed, nice catch. Attached is my proposal for this, combining your 0001 and 0003 patches with some docs and test fixups to match. -- Daniel Gustafsson https://vmware.com/