-
-
Notifications
You must be signed in to change notification settings - Fork 513
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
Add support for handlers #7454
Comments
Hey @tim-oh-thee, Just wanted to make sure we are on the same page. Not support for the |
Yep you’re absolutely right. My apologies for any confusion. |
Hi @tim-oh-thee, would you be willing to share the specific behavior you are interested in? We don't meaningfully support handler execution right now and there are a lot of different features. Most condition filtering is based on JDBC sql state codes, and we also do not support those currently. For example, I can see a path towards supporting specific SQL error code integers because that is independent of state codes. If you need state code support I would need to do more research to figure out how to add that separate layer. |
Aha that might be the right place to start. I was trying to do that exact thing. I forgot that I was coming up with the same sql state no matter what. |
The way the current code works is that you can only create |
Want to make sure I'm understanding this correctly. Essentially you'll be providing me the capability to say: but since there is no granularity in the error messages, I won't be able to control whether that handler is working on a specific issue (for example only an error for when a table doesn't exist). It'd essentially execute the body of the handler for every error. If this understanding is correct, then this makes sense to me and fits my intent with what I was trying to do in the first place. It'd be nice to see this built out more in the future for different error codes or sql states, etc.. |
Did a deeper pass and I think it's going to be more involved than I originally thought. Do you have any codes other than |
For context, one of the problems here is that we do not have a 3-way mapping between sql states, error codes, and Dolt error types. So we can go and catalog all of our error types, but there are thousands of relationships we do have and probably more that we do not or need to be refactored to support full sql state partitioning. The second problem is adding callbacks at any point where errors happen in stored procedure execution to perform the filtering and handler check. The first version of this feature only implemented the The space of handler behavior is big and I'd prefer unblock you soon rather than spending a month trying to hit every error code. There are certain common errors that could start cataloging and releasing first -- "table not found", "column not found", "syntax error", procedure specific errors, ...etc. But I am also not the stored procedure expert and guidance on your use case would help us make sure we're fixing what you need. |
Could we do the SQLEXCEPTION one? |
1051 was just the example I pulled from the documentation, nothing important about that one specifically. |
Yeah I was thinking the same thing last night, I'll start adding |
Thanks for the help! |
Thanks for your patience @tim-oh-thee, I have a PR here that id some directional progress that you might find useful: dolthub/go-mysql-server#2323. This should support We will let you know when this PR makes it into a Dolt release. |
Perfect, thank you Max! |
The changes should be in dolt |
The documentation here: https://docs.dolthub.com/sql-reference/sql-support/supported-statements states that handlers are only supported for cursors. Could we add support for these? I was recently trying to create a procedure and handle potential errors and didn't really have an option to do it.
MySQL reference: https://dev.mysql.com/doc/refman/8.0/en/handler.html
The text was updated successfully, but these errors were encountered: