Skip to content
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

🐛 fix logic of parsing multiple columns (i.e. for PRIMARY KEYS, CONSTRAINT) #193

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

Shion1305
Copy link
Contributor

Description

This PR is a partial fix for issue #192.

Bug Descriptions:

  • The current logic fails to parse multiple columns in PRIMARY KEY expressions (e.g., PRIMARY KEY (column1, column2)).
  • It does not properly recognize certain column names, such as column,1.

Changes Introduced

  • This PR addresses the first bug by improving the logic for parsing multiple columns within parentheses.
  • The parseAllColumns function is now capable of correctly parsing column names, even when they are escaped, like ("column""1").

Additional Notes:

The second bug (handling of column names with commas) will be addressed in a separate PR, which is still in progress.

Reference

SQLite implements its escaping logic as follows:
https://github.com/sqlite/sqlite/blob/cf25c16a54f68d1ca095b91bd0ead840578b2bb4/ext/fts3/fts3.c#L464-L486

  • Do only one thing
  • Non breaking API changes
  • Tested

User Case Description

Refer test cases.

@Shion1305
Copy link
Contributor Author

@jinzhu Hi! Is there any change you could review this PR? Thanks in advance 🙏

@jinzhu jinzhu merged commit 02b8e06 into go-gorm:master Sep 30, 2024
3 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.

2 participants