Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parsing data-modifying statements in WITH #18

Open
tsmacdonald opened this issue Apr 8, 2024 · 0 comments
Open

Support parsing data-modifying statements in WITH #18

tsmacdonald opened this issue Apr 8, 2024 · 0 comments

Comments

@tsmacdonald
Copy link
Member

This is legal in Postgres

But fails

(deftest complicated-mutations-test
  (is (= #{"delete" "insert"}
         (mutations "WITH outdated_orders AS (
                       DELETE FROM orders
                       WHERE
                         date <= '2018-01-01'
                       RETURNING *
                     )
                     INSERT INTO order_log
                     SELECT * from outdated_orders;"))))

with


macaw.core-test
1 non-passing tests:

Error in complicated-mutations-test

expected: (=
	   #{"delete" "insert"}
	   (mutations
	    "WITH outdated_orders AS (
                       DELETE FROM orders
                       WHERE
                         date <= '2018-01-01'
                       RETURNING *
                     )
                     INSERT INTO order_log
                     SELECT * from outdated_orders;"))

   error: net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "DELETE" "DELETE"
    at line 2, column 24.

Was expecting:

    "WITH"


	  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant