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

Handle NULL parameters like MySQL #3132

Closed
tirsen opened this issue Sep 4, 2017 · 3 comments
Closed

Handle NULL parameters like MySQL #3132

tirsen opened this issue Sep 4, 2017 · 3 comments

Comments

@tirsen
Copy link
Collaborator

tirsen commented Sep 4, 2017

When you pass in a NULL parameter to a prepared statement query MySQL handles that just fine. Vitess on the other hand gives the following error:

Caused by: java.sql.SQLNonTransientException: Vitess RPC error: legacy_code: UNKNOWN_ERROR_LEGACY
message: "vtgate: http://localhost:15001/: paramsSelectEqual: hash.Map: could not parse value: "
code: UNKNOWN
@tirsen
Copy link
Collaborator Author

tirsen commented Sep 4, 2017

(Technically you should be using an IS NULL clause in this case but it wouldn't be the first time that MySQL diverges from the SQL standard. I think Vitess should conform to MySQL as much as possible to minimize porting effort.)

@sougou
Copy link
Contributor

sougou commented Sep 4, 2017

I think the vitess behavior for the use case you showed is correct. It's not able to map a NULL value to a keyspace id. Vitess allows nulls as bind vars, but they should be used with care. For example, where id = NULL is always FALSE 😭. I actually looked at doctoring equality expressions to is null, but realized the risk because values are used in so many other constructs, like IN clauses, etc. So, there's no way to uniformly extend the null handling semantics for all constructs.

@sougou
Copy link
Contributor

sougou commented Nov 13, 2017

This is now addressed via #3182

@sougou sougou closed this as completed Nov 13, 2017
frouioui pushed a commit to planetscale/vitess that referenced this issue Nov 21, 2023
…ttler: empty list of probes on non-leader (vitessio#3132)

* backport of 3130

* resolved conflict

Signed-off-by: Shlomi Noach <[email protected]>

---------

Signed-off-by: Shlomi Noach <[email protected]>
Co-authored-by: Shlomi Noach <[email protected]>
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

2 participants