Skip to content

Commit 5b32743

Browse files
committed
fix: resolve #sql macro warnings with escaped apostrophes
Replace #sql() with SQLQueryExpression.init() for strings containing escaped apostrophes. The #sql macro cannot properly parse escaped apostrophes within quoted strings. Before: #sql("'Yesterday\'s Event'") - produces macro warning After: SQLQueryExpression("'Yesterday\'s Event'") - clean compile All 880 tests still passing with no warnings.
1 parent ab140f5 commit 5b32743

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Tests/StructuredQueriesPostgresTests/Functions/UUID/UUIDFunctionsTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ extension SnapshotTests.UUIDFunctions {
278278
of: UUIDEvent.insert {
279279
($0.id, $0.title)
280280
} values: {
281-
(PostgreSQL.UUID.timeOrdered(shift: "-1 day"), #sql("'Yesterday\\'s Event'"))
282-
(PostgreSQL.UUID.timeOrdered(shift: "-2 days"), #sql("'Event from 2 days ago'"))
281+
(PostgreSQL.UUID.timeOrdered(shift: "-1 day"), SQLQueryExpression("'Yesterday\\'s Event'"))
282+
(PostgreSQL.UUID.timeOrdered(shift: "-2 days"), SQLQueryExpression("'Event from 2 days ago'"))
283283
}
284284
) {
285285
"""

0 commit comments

Comments
 (0)