-
-
Notifications
You must be signed in to change notification settings - Fork 138
List Support for SQL IN Clause #434
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
base: master
Are you sure you want to change the base?
Conversation
@oshai can you help me with this?
What do I have to fix? |
I just rerun it, hth. |
@oshai Thx. Please review my code then.😃 |
I guess for the long run it makes more sense to support can mysql client/server protocol pass a list object in one placeholder like that? |
yes, I think postgres will better fit here. for mysql you can see what the jdbc mysql driver does (it still needs to support arrays) and do something similar. |
Hi @oshai, Proposal: Safe List Expansion for IN ClausesAfter careful review, our most robust and safest path forward is to support list expansion for Why Automatic Expansion for Positional Placeholders is UnsafeAttempting to automatically expand positional Consider a query like: SET status = ? WHERE id IN (?) If the library were to automatically expand The Advantage of Named ParametersNamed parameters, such as Final Implementation PlanBased on this analysis, our final implementation plan is as follows:
This approach allows us to provide a powerful convenience feature—list expansion in What are your thoughts on this direction? |
Currently the driver do not support named params at all. But when using with the r2dbc adapter it add such support iirc. So I don't know if adding such support is beneficial. It will require us in the client side to parse the statement which we don't do right now (might impct performance, be fragile, etc') So I would start with just supporting it in postgres by sending array param. |
![]() @oshai ok~ I see. So in postgres does it gonna change like = ANY(array['Ava', 'Dave']) ? |
Not sure I follow. |
Description
This PR adds support for List encoding and resolves mapping issues when using ArrayList with SQL IN clauses.
Key Changes
Added ListEncoder Support in BinaryRowEncoder - Enables conversion of List types to MySQL length-encoded comma-separated strings
Created ListEncoder Tests - Comprehensive test suite verifying various list encoding scenarios (empty lists, single/multiple items, null filtering, etc.)
Implemented ArrayListInClause Tests - Demonstrates the issue with ArrayList in SQL IN clauses and provides two solutions:
Using correct SQL placeholders
Related Issue
#289