fix: db-pre-config function failing with pg reserved words
When db-pre-config is accidentally set to a pg reserved word
like "true", it fails with a confusing error. The function
names should be properly quoted to avoid such errors. This commit
resolves this by quoting the pre-config function name.
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
(cherry picked from commit a688878236)
This commit is contained in:
committed by
Steve Chavez
parent
939061baff
commit
4aa712b9d8
@@ -10,6 +10,7 @@ module PostgREST.SchemaCache.Identifiers
|
||||
, dumpQi
|
||||
, escapeIdent
|
||||
, isAnyElement
|
||||
, quoteQi
|
||||
, toQi
|
||||
, trimNullChars
|
||||
) where
|
||||
@@ -41,6 +42,10 @@ dumpQi :: QualifiedIdentifier -> Text
|
||||
dumpQi (QualifiedIdentifier s i) =
|
||||
(if T.null s then mempty else s <> ".") <> i
|
||||
|
||||
quoteQi :: QualifiedIdentifier -> Text
|
||||
quoteQi (QualifiedIdentifier s i) =
|
||||
(if T.null s then mempty else escapeIdent s <> ".") <> escapeIdent i
|
||||
|
||||
-- TODO: Handle a case where the QI comes like this: "my.fav.schema"."my.identifier"
|
||||
-- Right now it only handles the schema.identifier case
|
||||
toQi :: Text -> QualifiedIdentifier
|
||||
|
||||
Reference in New Issue
Block a user