Fix Event Trigger creation for MSSQL tables with reserved word columns (close #9929) #9926
+4
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When creating an Event Trigger in Hasura for MSSQL, if the table's column name contains reserved words like
group
, it results in an error. This PR addresses this issue by wrapping all column names with[]
in the Trigger creation SQL issued by Hasura, ensuring proper escaping and preventing such errors.Changelog
Component : server
Type: bugfix
Product: community-edition
Short Changelog
Fixed an issue where Event Triggers for MSSQL failed for tables with columns named after reserved words.
Long Changelog
[]
, providing proper escaping.Related Issues
#9929
Solution and Design
To address the issue where reserved words as column names caused failures, we've wrapped every column name with square brackets
[]
in the Trigger creation SQL. This ensures proper escaping and allows the SQL command to be processed without errors.Steps to test and verify
group
or any other reserved word.Limitations, known bugs & workarounds
No known limitations or bugs at this time.
Server checklist
Catalog upgrade
Does this PR change Hasura Catalog version?
Metadata
Does this PR add a new Metadata feature?
run_sql
auto manages the new metadata through schema diffing?run_sql
auto manages the definitions of metadata on renaming?export_metadata
/replace_metadata
supports the new metadata added?GraphQL
Breaking changes
No Breaking changes
There are breaking changes:
Metadata API
Existing
query
types:args
payload which is not backward compatibleJSON
schemaGraphQL API
Schema Generation:
NamedType
Schema Resolve:-
null
value for any input fieldsLogging
JSON
schema has changedtype
names have changed