You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: airbyte-integrations/connectors/source-mssql/src/main/kotlin/io/airbyte/integrations/source/mssql/MsSqlSourceOperations.kt
+18-4Lines changed: 18 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -297,17 +297,31 @@ class MsSqlSourceOperations :
297
297
}
298
298
}
299
299
300
-
fun Field.sql(): String=if (type isMsSqlServerHierarchyFieldType) "$id.ToString()"else"$id"
300
+
/**
301
+
* Quotes an identifier for SQL Server using square brackets. If the identifier contains a
302
+
* closing bracket ']', it will be escaped as ']]'. This protects against reserved keywords and
303
+
* special characters in identifier names.
304
+
*/
305
+
fun String.quoted(): String="[${this.replace("]", "]]")}]"
306
+
307
+
fun Field.sql(): String=
308
+
if (type isMsSqlServerHierarchyFieldType) "${id.quoted()}.ToString()"else id.quoted()
Copy file name to clipboardExpand all lines: airbyte-integrations/connectors/source-mssql/src/test/kotlin/io/airbyte/integrations/source/mssql/MsSqlServerSourceSelectQueryGeneratorTest.kt
+33-16Lines changed: 33 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ class MsSqlServerSourceSelectQueryGeneratorTest {
40
40
From("users", "dbo"),
41
41
limit =Limit(0),
42
42
)
43
-
.assertSqlEquals("""SELECT TOP 0 id, name FROM dbo.users""")
43
+
.assertSqlEquals("""SELECT TOP 0 [id], [name] FROM [dbo].[users]""")
44
44
}
45
45
46
46
@Test
@@ -49,7 +49,7 @@ class MsSqlServerSourceSelectQueryGeneratorTest {
| 4.3.0-rc.5 | 2025-11-08 |[69248](https://github.com/airbytehq/airbyte/pull/69248)| Add SQL Server identifier quoting to fix reserved keyword issues |
457
458
| 4.3.0-rc.4 | 2025-11-05 |[69194](https://github.com/airbytehq/airbyte/pull/69194)| Fix composite primary key discovery to show all PK columns; separate PK discovery from sync strategy |
458
459
| 4.3.0-rc.3 | 2025-10-31 |[69097](https://github.com/airbytehq/airbyte/pull/69097)| Fix connector state value type from string to json object |
459
460
| 4.3.0-rc.2 | 2025-10-29 |[69093](https://github.com/airbytehq/airbyte/pull/69093)| Fix state parsing error for integer and number |
0 commit comments