-
-
Notifications
You must be signed in to change notification settings - Fork 214
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 for doltgres prepared statements #2239
Conversation
There is enough here that I understand what you're trying to do. My worry is how to make sure we can reliably expand the type inference going into the future. We can do a lot with comparison functions with one level deep bindvars, but manually pattern matching more complicated expression trees is brittle. For example, supporting arithmetic functions, case statements, subqueries,...etc are all supportable for single-nesting only. Unary functions can obfuscate bindvars in arbitrary complicated ways that hinder the one-level deep pattern matching (ex; We probably need some sort of bottom-up info passing to know that a subtree contains a bindvar, and only trying to do true ups when we missed info. The structure of this problem is similar to type coercion, which is the more general problem of validating expression types. Bindvar coercion for DML statements is the simplest case. We only need to pass top-down hints from the target columns through to bindvars. Resolving SELECT statements like The problem with type coercion in general is that it inserts expression nodes into the tree in the process of resolving intermediate node types. A partial type inference that supports bindvar types would add functional type information to bindvars, but hides the same info on intermediate expressions in a way that is opaque to execution. The pros are that a type coercion framework is a precursor to fixing other type problems, and organizationally separates typing code from the rest of analysis. |
…into zachmu/prepared
See dolthub/vitess#299 for new handler interface
This includes three main changes:
I'm most interested in feedback on 3) before I go deeper on it. It's implemented only for insert values and comparison expressions (used in filters). A complete solution also requires support for UPDATE and probably some other expression types. If this approach is too hacky or is likely to break or interfere with other things, I want to know before continuing. If the latter, it would be pretty easy to introduce a bind context specific to this use case and not assign types unless it's set.
See dolthub/doltgresql#87 for how doltgres uses this new bindvar type information.