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
CTE Compiles in Incorrect Order for Oracle Insert From Select #4275
Comments
Michael Bayer (@zzzeek) wrote: so for testing, do you know if Oracle supports CTE for UPDATE and DELETE also? most of the work here is building out the test suite to start exercising so-called "Backend" cte expressions against different databases. |
Changes by Michael Bayer (@zzzeek):
|
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: (perfect bug report btw! :) ) |
James Frick wrote: Update syntax is the same: Delete syntax is similar, though the only way I could get a working example is with an ANY or EXISTS.
That would delete all rows successfully. Tested in Oracle 12c. |
Michael Bayer (@zzzeek) wrote: OK I may need to break out the testing requirements markers a bit for that....this is all on my end |
Michael Bayer (@zzzeek) wrote: OK that UPDATE syntax is not the full blown CTE UPDATE postgresql supports, as that requires UPDATE..FROM. So I need to test that separately |
Michael Bayer (@zzzeek) wrote: OK....in order to move forward we're going to get the test support in, which is also #4230, and get INSERT ...WITH..SELECT working. the embedding of the WITH inside the subquery is a bigger issue that I'm going to leave out for now (doesn't work like that, CTE always goes to the top). |
Michael Bayer (@zzzeek) wrote: https://gerrit.sqlalchemy.org/#/q/I8ac337104d5c546dd4f0cd305632ffb56ac8bf90 |
Michael Bayer (@zzzeek) wrote: render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL Fixed INSERT FROM SELECT with CTEs for the Oracle and MySQL dialects, where Also adds test suite support CTEs against backends. Change-Id: I8ac337104d5c546dd4f0cd305632ffb56ac8bf90 → 3619edc |
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: render WITH clause after INSERT for INSERT..SELECT on Oracle, MySQL Fixed INSERT FROM SELECT with CTEs for the Oracle and MySQL dialects, where Also adds test suite support CTEs against backends. Change-Id: I8ac337104d5c546dd4f0cd305632ffb56ac8bf90 → 6529c47 |
Migrated issue, originally created by James Frick
Oracle 12c
cx_Oracle==6.2.1
SQLalchemy==1.2.8
Description:
Oracle CTEs used in an insert().from_select() compile in the wrong order. Oracle expects the INSERT clause to render before the WITH clause.
Example modified from here.
Out:
Trace:
Following the examples in test_compiler I think the following test case would work (if I'm understanding assert_compile correctly).
Posted to the mailing list here
The text was updated successfully, but these errors were encountered: