From 80721e32ccbfb5a2e9d122fdc54e0c2d7f45b65d Mon Sep 17 00:00:00 2001 From: wismna Date: Tue, 10 Dec 2024 22:55:44 -0500 Subject: [PATCH] Surround index column name with brackets Surround column name with brackets to avoid issues when the column name is the same as a reserved keyword (e.g. index) --- .../com/github/caiiiycuk/pg2sqlite/command/CreateIndex.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/com/github/caiiiycuk/pg2sqlite/command/CreateIndex.scala b/src/main/scala/com/github/caiiiycuk/pg2sqlite/command/CreateIndex.scala index 7a30bc6..1425371 100644 --- a/src/main/scala/com/github/caiiiycuk/pg2sqlite/command/CreateIndex.scala +++ b/src/main/scala/com/github/caiiiycuk/pg2sqlite/command/CreateIndex.scala @@ -26,7 +26,7 @@ object CreateIndex extends Command with Log { val createIndexParts = rawSql.split("""\s+on\s+""") val indexName = createIndexParts(0).tokens(INDEX_NAME_POSITION) val tableName = createIndexParts(1).tokens(TABLE_NAME_POSITION) - val columns = rawSql.takeBraces.head.columns.map(_.name).mkString(",") + val columns = rawSql.takeBraces.head.columns.map(column => s"[${column.name}]").mkString(",") (tableName, s"CREATE INDEX $indexName ON $tableName ($columns)", columns) } catch {