postgrespro/testgres

An incorrect generation of parameter list for "CREATE SUBSCRIPTION" in Subscription class

Opened this issue · 0 comments

Documentation says - subscription_parameters must be enumerated through 'comma' symbol:

https://www.postgresql.org/docs/current/sql-createsubscription.html

CREATE SUBSCRIPTION subscription_name
    CONNECTION 'conninfo'
    PUBLICATION publication_name [, ...]
    [ WITH ( subscription_parameter [= value] [, ... ] ) ]

Subscription class does it with 'space' symbol:

testgres/testgres/pubsub.py

Lines 136 to 142 in bab1d8e

query = (
"create subscription {} connection '{}' publication {}").format(
name, options_string(**conninfo), self.pub.name)
# additional parameters
if params:
query += " with ({})".format(options_string(**params))

See options_string function:

testgres/testgres/utils.py

Lines 265 to 266 in bab1d8e

def options_string(separator=u" ", **kwargs):
return separator.join(u"{}={}".format(k, v) for k, v in iteritems(kwargs))

Plan

  • Create the tests
  • Fix a problem