Hi hackers. This post is about parameter default values. Specifically. it's about the CREATE PUBLICATION and CREATE SUBSCRIPTION syntax, although the same issue might apply to other commands I am unaware of...
~~~ Background: CREATE PUBLICATION syntax has a WITH clause: [ WITH ( publication_parameter [= value] [, ... ] ) ] CREATE SUBSCRIPTION syntax has a similar clause: [ WITH ( subscription_parameter [= value] [, ... ] ) ] ~~~ The docs describe all the parameters that can be specified. Parameters are optional, so the docs describe the defaults if the parameter name is not specified. However, notice that the parameter *value* part is also optional. So, what is the defined behaviour if a parameter name is specified but no *value* is given? In practice, it seems to just be a shorthand for assigning a boolean value to true... BUT - a) I can't find anywhere in the docs where it actually says this b) Without documentation some might consider it to be strange that now there are 2 kinds of defaults - a default when there is no name, and another default when there is no value - and those are not always the same. e.g. if publish_via_partition root is not specified at all, it is equivalent of WITH (publish_via_partition_root=false), but OTOH, WITH (publish_via_partition_root) is equivalent of WITH (publish_via_partition_root=true). c) What about non-boolean parameters? In practice, it seems they all give errors: test_pub=# CREATE PUBLICATION pub99 FOR ALL TABLES WITH (publish); ERROR: publish requires a parameter test_sub=# CREATE SUBSCRIPTION sub1 CONNECTION 'host=localhost dbname=test_pub' PUBLICATION pub1 WITH (slot_name); ERROR: slot_name requires a parameter test_sub=# CREATE SUBSCRIPTION sub1 CONNECTION 'host=localhost dbname=test_pub' PUBLICATION pub1 WITH (synchronous_commit); ERROR: synchronous_commit requires a parameter ~~~ It almost feels like this is an undocumented feature, except it isn't quite undocumented because it is right there in black-and-white in the syntax "[= value]". Or perhaps this implied boolean-true behaviour is already described elsewhere? But if it is, I have not found it yet. IMO a simple patch (PSA) is needed to clarify the behaviour. Thoughts? ------ Kind Regards, Peter Smith. Fujitsu Australia
v1-0001-clarify-behavior-of-specifying-a-parameter-with-n.patch
Description: Binary data