8000 fix: db guc set supports quoted param by GabriellePoncey · Pull Request #345 · pgEdge/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: db guc set supports quoted param #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GabriellePoncey
Copy link

Adds an extra set of quotations to the guc_value portion of the ALTER SYSTEM SET SQL in order to support spaced, quoted guc values.

PLAT-44

…ons to the guc_value portion of the ALTER SYSTEM SET SQL in order to support spaced, quoted guc values \n PLAT-44
pg_v, spock_v = util.get_pg_v()
pg = pg_v[2:]

nc = "./pgedge "
ncb = nc + "pgbin " + str(pg) + " "

cmd = f"ALTER SYSTEM SET {guc_name} = {guc_value}"
cmd = f"ALTER SYSTEM SET {guc_name} = '{guc_value}'"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! This looks like it solves the immediate issue. Since we're quoting the string, we should also consider escaping single quotes and backslashes in guc_value. In order to do that, you double any single-quote or backslash characters in the string. Patroni does this in an elegant way with a regex: https://github.com/patroni/patroni/blob/1ee6c5a651d2ebc30a698a7b9859177674571291/patroni/postgresql/config.py#L298

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0