diff --git a/src/PostgREST/App.hs b/src/PostgREST/App.hs index eb47231ffb4..bbc098d1d37 100644 --- a/src/PostgREST/App.hs +++ b/src/PostgREST/App.hs @@ -164,7 +164,7 @@ runDbHandler appState mode authenticated prepared handler = do liftEither resp handleRequest :: AuthResult -> AppConfig -> AppState.AppState -> Bool -> Bool -> ByteString -> PgVersion -> ApiRequest -> SchemaCache -> Handler IO Wai.Response -handleRequest AuthResult{..} conf appState authenticated prepared jsonDbS pgVer apiReq@ApiRequest{..} sCache = +handleRequest _ conf appState authenticated prepared _jsonDbS pgVer apiReq@ApiRequest{..} sCache = case (iAction, iTarget) of (ActionRead headersOnly, TargetIdent identifier) -> do rPlan <- liftEither $ Plan.readPlan identifier conf sCache apiReq @@ -216,5 +216,6 @@ handleRequest AuthResult{..} conf appState authenticated prepared jsonDbS pgVer where runQuery mode query = runDbHandler appState mode authenticated prepared $ do - Query.setPgLocals conf authClaims authRole apiReq jsonDbS pgVer + Query.select1 + -- Query.setPgLocals conf authClaims authRole apiReq jsonDbS pgVer query diff --git a/src/PostgREST/Query.hs b/src/PostgREST/Query.hs index 35fbddfce29..86fb1f36ff8 100644 --- a/src/PostgREST/Query.hs +++ b/src/PostgREST/Query.hs @@ -8,6 +8,7 @@ module PostgREST.Query , readQuery , singleUpsertQuery , updateQuery + , select1 , setPgLocals , DbHandler ) where @@ -232,6 +233,9 @@ optionalRollback AppConfig{..} ApiRequest{..} = do shouldRollback = configDbTxAllowOverride && iPreferTransaction == Just Rollback +select1 :: DbHandler () +select1 = lift $ SQL.sql "select 1" + -- | Runs local(transaction scoped) GUCs for every request, plus the pre-request function setPgLocals :: AppConfig -> KM.KeyMap JSON.Value -> Text -> ApiRequest -> ByteString -> PgVersion -> DbHandler ()