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
ALTER TABLE .. RENAME TO .. should fully qualify tables if supported by the database #8042
Comments
It seems like now the second table is always qualified, which leads to a failure on Postgres with 3.11.9 for us. MySQL was failing before because of the missing qualification but is working now since the table2 is now qualified. This is what is now generated for the Postgres Profile: |
@do4gr Thanks for your comment. How are you calling the API to get this behaviour? Using generated code? The workaround is obviously to create an unqualified table reference, e.g. by calling |
Thanks for the quick response! This is the jooq call we're making: This generates So I think the correct behaviour would be to qualify the renameTo on MySql but not on Postgres. We would like to have the same jooq call for different SQL variants and I was hoping this bug fix would enable this. Having separate jooq calls for different dialects is of course a possibility, but something we would like to avoid since we are passing in different dialects at runtime and really love that jooq in most cases allows us to still only have one definition per statement. |
Thanks for the additional comments. Yes of course, I agree. The same statement should work on all RDBMS, if it can be reasonably emulated. I was just pointing out a workaround for the time being, and also for others who may stumble upon this. The issue title is quite clear, and according to that title, this issue was not implemented correctly. |
Fixed for jOOQ 3.12. Backport will be scheduled again under #8043, for 3.11.10 |
Currently, the
ALTER TABLE schema.table1 RENAME TO schema.table2
statement does not qualify thetable2
table, because that's not supported in a few databases. We should always qualify the table if such qualification is provided, as the semantics of the statement may change depending on what the session's default schema / database may be.See: https://stackoverflow.com/q/53210516/521799
The text was updated successfully, but these errors were encountered: