postgresql-syntax 0.4.3 → 0.4.3.1
raw patch · 3 files changed
+25/−5 lines, 3 files
Files
- library/PostgresqlSyntax/Parsing.hs +13/−3
- postgresql-syntax.cabal +1/−1
- tasty-test/Main.hs +11/−1
library/PostgresqlSyntax/Parsing.hs view
@@ -336,9 +336,17 @@ sharedSelectNoParens with = do select <- selectClause sort <- optional (space1 *> sortClause)- limit <- optional (space1 *> selectLimit)- forLocking <- optional (space1 *> forLockingClause)+ (limit, forLocking) <- limitFirst <|> forLockingFirst <|> pure (Nothing, Nothing) return (SelectNoParens with select sort limit forLocking)+ where+ limitFirst = do+ limit <- space1 *> selectLimit+ forLocking <- optional (space1 *> forLockingClause)+ pure (Just limit, forLocking)+ forLockingFirst = do+ forLocking <- space1 *> forLockingClause+ limit <- optional (space1 *> selectLimit)+ pure (limit, Just forLocking) -- | -- The one that doesn't start with \"WITH\".@@ -1149,7 +1157,9 @@ AllSubType <$ keyword "all" ] -inExpr = SelectInExpr <$> wrapToHead selectWithParens <|> ExprListInExpr <$> inParens exprList+inExpr =+ (ExprListInExpr <$> parse (Megaparsec.try (toParsec (inParens exprList))))+ <|> (SelectInExpr <$> wrapToHead selectWithParens) symbolicBinOpExpr a bParser constr = do binOp <- label "binary operator" (space *> wrapToHead symbolicExprBinOp <* space)
postgresql-syntax.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: postgresql-syntax-version: 0.4.3+version: 0.4.3.1 category: Database, PostgreSQL, Parsing synopsis: PostgreSQL AST parsing and rendering description:
tasty-test/Main.hs view
@@ -26,7 +26,17 @@ \inner join edgenode.usere_provider as p\n\ \on u.id = p.user_id\n\ \inner join edgenode.provider_branch as b\n\- \on b.provider_fk = p.provider_id"+ \on b.provider_fk = p.provider_id",+ -- FOR locking clause before LIMIT (PostgreSQL accepts both orderings)+ "select * from items for update limit 1",+ "select * from items limit 1 for update",+ "select * from items for share limit 10",+ "select * from items for no key update limit 1",+ "select * from items for key share limit 1",+ "select * from items for update of items nowait limit 1",+ "select * from items for update skip locked limit 1",+ "select * from items order by id for update limit 1",+ "select * from items for update offset 5 limit 10" ], testParserOnAllInputs "typename"