Skip to content

docs: document connection string escaping rules (issue #140) - #197

Merged
davecramer merged 1 commit into
mainfrom
doc/connstring-escaping-issue-140
Jul 29, 2026
Merged

docs: document connection string escaping rules (issue #140)#197
davecramer merged 1 commit into
mainfrom
doc/connstring-escaping-issue-140

Conversation

@davecramer

Copy link
Copy Markdown
Contributor

A connection string is processed by two independent parsers with different escaping rules, which was undocumented and confusing:

  1. The psqlODBC parser splits on ';' and '=' and uses braces {} (with '}}' for a literal brace) or +/%XX percent-encoding to embed special characters. Backslash is NOT special at this layer.
  2. A pqopt value is handed to libpq, whose conninfo parser separates parameters by spaces and uses backslash / single-quote quoting.

Document both layers in config.html and add connstring-escape-test, which sets application_name through each mechanism and reads it back with current_setting() to confirm the special character survives intact.

Reported-by: fjf2002

A connection string is processed by two independent parsers with
different escaping rules, which was undocumented and confusing:

  1. The psqlODBC parser splits on ';' and '=' and uses braces {} (with
     '}}' for a literal brace) or +/%XX percent-encoding to embed special
     characters. Backslash is NOT special at this layer.
  2. A pqopt value is handed to libpq, whose conninfo parser separates
     parameters by spaces and uses backslash / single-quote quoting.

Document both layers in config.html and add connstring-escape-test, which
sets application_name through each mechanism and reads it back with
current_setting() to confirm the special character survives intact.

Reported-by: fjf2002
@davecramer
davecramer merged commit 9120603 into main Jul 29, 2026
9 checks passed
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.

1 participant