Skip to content

Comments

fix: constraint name quoting#165

Merged
tianzhou merged 1 commit intomainfrom
constraint_name_with_space
Nov 16, 2025
Merged

fix: constraint name quoting#165
tianzhou merged 1 commit intomainfrom
constraint_name_with_space

Conversation

@tianzhou
Copy link
Contributor

Further fix #78

Copilot AI review requested due to automatic review settings November 16, 2025 06:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances constraint name quoting to properly handle identifiers that require quotes according to PostgreSQL rules, specifically addressing constraint names containing whitespace as mentioned in GitHub issue #78.

  • Systematically wraps all constraint name references with ir.QuoteIdentifier() across the codebase
  • Adds test case with a constraint named "price not negative" to verify proper quoting of names with spaces
  • Updates test function name and test data directory to reflect the expanded scope

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testdata/dump/issue_78_constraint_not_valid_and_quoting/raw.sql Adds test constraint with whitespace in name to verify proper quoting
testdata/dump/issue_78_constraint_not_valid_and_quoting/pgschema.sql Expected pgschema output showing properly quoted constraint name
testdata/dump/issue_78_constraint_not_valid_and_quoting/pgdump.sql Expected pgdump output showing properly quoted constraint name
testdata/dump/issue_78_constraint_not_valid_and_quoting/manifest.json Test manifest documenting the constraint name quoting test case
testdata/dump/issue_78_constraint_not_valid/manifest.json Removed old manifest (test case consolidated)
internal/plan/rewrite.go Wraps constraint names with ir.QuoteIdentifier() in rewrite operations
internal/diff/type.go Wraps constraint names with ir.QuoteIdentifier() in domain type ALTER statements
internal/diff/trigger.go Wraps trigger names with ir.QuoteIdentifier() for constraint triggers
internal/diff/table.go Wraps constraint names with ir.QuoteIdentifier() throughout table ALTER statements
internal/diff/constraint.go Wraps constraint names with ir.QuoteIdentifier() in constraint SQL generation
cmd/dump/dump_integration_test.go Renames test function to reflect expanded scope including quoting tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tianzhou tianzhou merged commit e5b69d7 into main Nov 16, 2025
8 checks passed
@tianzhou tianzhou deleted the constraint_name_with_space branch November 23, 2025 14:51
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.

Error: failed to parse desired state schema file: failed to split SQL statements: syntax error at or near "NOT"

1 participant