Skip to content

Quote column identifiers in binary_copy_to_table - #178

Open
hippi345 wants to merge 2 commits into
psqlpy-python:mainfrom
hippi345:cursor/support-quoting-column-names-4139
Open

hippi345 wants to merge 2 commits into
psqlpy-python:mainfrom
hippi345:cursor/support-quoting-column-names-4139

Conversation

@hippi345

Copy link
Copy Markdown

Description

binary_copy_to_table now passes column names through quote_ident when building the COPY table(col1, col2, ...) clause, so identifiers that need quoting (e.g. a-b) work without callers wrapping names in double quotes manually.

Motivation and Context

copy_records_to_table already quoted column names; binary_copy_to_table joined raw strings and caused syntax errors for non-simple identifiers.

Closes #71

How has this been tested?

  • Added python/tests/test_binary_copy_quoted_columns.py (table with "a-b", binary COPY with columns=["a-b"]).
  • prek run -a
  • cargo fmt --check and cargo clippy -p psqlpy --all-features with the CI warning flags
  • pytest -vv --ignore=python/tests/test_ssl_mode.py: 262 passed against local PostgreSQL 16. test_ssl_mode.py was not run locally (no SSL-enabled Postgres here); CI covers it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

hippi345 and others added 2 commits October 30, 2026 15:22
Use quote_ident for COPY column lists so names like a-b work without
manual double-quoting, matching copy_records_to_table behavior.
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.

Support "quoting" column names

1 participant