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 error drop column with reserved word #20751

Closed
wants to merge 1 commit into from

Conversation

shoumoji
Copy link

@shoumoji shoumoji commented Dec 19, 2024

fix: #20750

Backquoted the column names when constructing the DROP COLUMN query

@shoumoji shoumoji requested a review from a team as a code owner December 19, 2024 06:18
Copy link

** WARNING **: This repository is generated by https://github.com/GoogleCloudPlatform/magic-modules. Any changes made directly to this repository will likely be overwritten. If you have further questions, please feel free to ping your reviewer or, internal employees, reach out to one of the engineers. Thank you!

for _, column := range droppedColumns {
backquotedDroppedColumns = append(backquotedDroppedColumns, fmt.Sprintf("`%s`", column))
}
droppedColumnsString := strings.Join(backquotedDroppedColumns, ", DROP COLUMN ")
Copy link
Author

@shoumoji shoumoji Dec 19, 2024

Choose a reason for hiding this comment

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

If droppedColumns = []string("column1", "column2") ,

backquotedDroppedColumns = []string("`column1`", "`column2`")
droppedColumnsString = "`column1`, DROP COLUMN `column2`"
dropColumnsDDL = "ALTER TABLE <table_id> DROP Column `column1`, DROP COLUMN `column2`"

Copy link
Contributor

Choose a reason for hiding this comment

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

This PR should be opened on the magic-modules repo instead as it's the code that generates the terraform-provider-google repo.

The exact file you would edit can be found here: https://github.com/GoogleCloudPlatform/magic-modules/blob/37e4abb059553f92e3eb4960ec0a2188a3cef77a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl#L2086-L2103

I'll be closing this PR, please make the changes in magic-modules!

@BBBmau BBBmau closed this Dec 19, 2024
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.

google_bigquery_table error attempting to DROP COLUMN with column name containing reserved words
2 participants