From d829fa55cc4c0ea9a7d2c3a127fc71259932d904 Mon Sep 17 00:00:00 2001 From: kataoka-ayumu Date: Fri, 20 Dec 2024 10:28:57 +0900 Subject: [PATCH] Fix error drop column with reserved word Signed-off-by: kataoka-ayumu --- .../services/bigquery/resource_bigquery_table.go.tmpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl index d1a0c7b1f18d..95589e22b57b 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table.go.tmpl @@ -2084,7 +2084,11 @@ func resourceBigQueryTableColumnDrop(config *transport_tpg.Config, userAgent str } if len(droppedColumns) > 0 { - droppedColumnsString := strings.Join(droppedColumns, ", DROP COLUMN ") + backquotedDroppedColumns := []string{} + for _, column := range droppedColumns { + backquotedDroppedColumns = append(backquotedDroppedColumns, fmt.Sprintf("`%s`", column)) + } + droppedColumnsString := strings.Join(backquotedDroppedColumns, ", DROP COLUMN ") dropColumnsDDL := fmt.Sprintf("ALTER TABLE `%s.%s.%s` DROP COLUMN %s", tableReference.project, tableReference.datasetID, tableReference.tableID, droppedColumnsString) log.Printf("[INFO] Dropping columns in-place: %s", dropColumnsDDL)