Adds a --quote-all option to the command line#179
Adds a --quote-all option to the command line#179Adam-Mustafa wants to merge 2 commits intopgplex:mainfrom
--quote-all option to the command line#179Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a --quote-all command-line flag that forces all identifiers (table names, column names, schemas) to be wrapped in double quotes, regardless of whether they are PostgreSQL reserved words or contain special characters requiring quotation.
Key changes:
- Introduces new quoting functions that accept a
forceQuoteboolean parameter - Propagates the
--quote-allflag through the command execution pipeline - Adds comprehensive test coverage for the new quoting behavior
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/dump/quote_all_test/pgdump.sql | Test fixture with mixed identifier types to validate quote-all behavior |
| ir/quote_test.go | Unit tests for new force-quoting functions |
| ir/quote.go | New functions QuoteIdentifierWithForce and QualifyEntityNameWithQuotesAndForce |
| internal/diff/table.go | Updated table/column SQL generation to use force-quoting when enabled |
| internal/diff/diff.go | Added Option pattern for migration configuration and QuoteAll option |
| cmd/root.go | Added --quote-all persistent flag and accessor function |
| cmd/plan/plan.go | Retrieves and passes quote-all flag to plan generation |
| cmd/dump/dump_integration_test.go | Integration test validating quote-all behavior |
| cmd/dump/dump.go | Retrieves and passes quote-all flag to dump execution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e170c3a to
b062113
Compare
b062113 to
c93b112
Compare
tianzhou
left a comment
There was a problem hiding this comment.
What's the problem are we trying to solve here? We'd like to avoid adding flags unless absolute necessary
|
Hi @tianzhou, It's just a choice in the output format. Other tools I've seen quote all values and my concern is that some missing value in the future would cause a break because the keyword is not in the list. At the same time, I didn't want to dramatically change the expected output. So I figured a reasonable middle ground was adding the option as a flag. If that's not in line with the repo, it's not absolutely necessary. It just makes the existing output slightly more brittle but still well within reason. |
|
@Adam-Mustafa thanks for providing the background. For the moment, we are holding off adding such a flag. |
Adds a
--quote-alloption to the command line which will make all column names be wrapped in quotes, not just the ones that need to be.