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

Fix Type Inference for Array Comparisons in SQL Queries #3084

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cmkqwerty
Copy link

Description
In array comparisons made using ANY/SOME/ALL operators, the auto-generated Go code has incorrect type declarations.

Related Issue

#3083

Changes

  • The QueryValue struct accepts an extra field. This QueryText field is of string type and contains the SQL query running in context.
  • isUsedWithArrayComparison(), a method belonging to the QueryValue struct, has been implemented. In the running SQL query, it checks whether any of the ANY/SOME/ALL operators are used for the current field and returns bool. In this way, we do not encapsulate it with pr.Array() and we can convert the slice type argument into single data.

If desired, I am more than willing to add comprehensive tests to cover the modified functionality. Please let me know if this is something you'd like to include, and I'll be happy to work on it.

@kyleconroy kyleconroy force-pushed the cmkqwerty/fix-array-comparison-type-inference branch from 2f14580 to 5140cc5 Compare November 25, 2024 06:50
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

Successfully merging this pull request may close these issues.

1 participant