Warn if initdb's --sync-only option is mixed with other options

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Warn if initdb's --sync-only option is mixed with other options
Date: 2021-07-07 02:23:54
Message-ID: CABwTF4VJW1m4Vg5NzMcfbhWUfs4Vz0yZdF1xseJ_QhE-J-O8MA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

When reading through code for my previous patch [1] I realized that
initdb does *not* warn users that it ignores all other options (except
-D/--pgdata) if the --sync-only option is used.

I'm not able to come up with an exact situation to prove this, but
this behaviour seems potentially dangerous. The user might mix the
--sync-only option with other options, but would be extremely
surprised if those other options didn't take effect.

I _think_ we should throw an error if the user specifies any options
that are being ignored. But an error might break someone's automation
(perhaps for their own good), since the current behaviour has been in
place for a very long time, so I'm willing to settle for at least a
warning in such a case.

[1]:
Slightly improve initdb --sync-only option's help message
https://www.postgresql.org/message-id/CABwTF4U6hbNNE1bv%3DLxQdJybmUdZ5NJQ9rKY9tN82NXM8QH%2BiQ%40mail.gmail.com

Best regards,
--
Gurjeet Singh http://gurjeet.singh.im/

Attachment Content-Type Size
v1-0001-Warn-if-sync-only-is-used-with-other-options.patch application/octet-stream 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-07-07 02:30:20 Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options
Previous Message Fujii Masao 2021-07-07 02:17:34 Re: postgres_fdw - should we tighten up batch_size, fetch_size options against non-numeric values?