From 9c6627547cde6c6f1ec442718d60f3daa4c7c9fa Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Tue, 2 Aug 2022 15:15:30 -0500 Subject: [PATCH] Provide the correct PostgreSQL syntax for SELECT locking clauses via the new SQLDialect properties. --- Sources/PostgresKit/PostgresDialect.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/PostgresKit/PostgresDialect.swift b/Sources/PostgresKit/PostgresDialect.swift index 8080a18..efa7379 100644 --- a/Sources/PostgresKit/PostgresDialect.swift +++ b/Sources/PostgresKit/PostgresDialect.swift @@ -59,4 +59,12 @@ public struct PostgresDialect: SQLDialect { public var unionFeatures: SQLUnionFeatures { [.union, .unionAll, .intersect, .intersectAll, .except, .exceptAll, .explicitDistinct, .parenthesizedSubqueries] } + + public var sharedSelectLockExpression: SQLExpression? { + SQLRaw("FOR SHARE") + } + + public var exclusiveSelectLockExpression: SQLExpression? { + SQLRaw("FOR UPDATE") + } }