vimeh opened a new issue, #20653:
URL: https://github.com/apache/datafusion/issues/20653

   ### Is your feature request related to a problem or challenge?
   
   When using the SQL unparser with `PostgreSqlDialect`, `array_has(haystack, 
needle)` is emitted as-is. PostgreSQL does not have an `array_has()` function, 
so this produces invalid SQL. The idiomatic Postgres equivalent is `needle = 
ANY(haystack)`.
   
   ### Describe the solution you'd like
   
   Add a `scalar_function_to_sql_overrides` entry in `PostgreSqlDialect` that 
converts `array_has(haystack, needle)` to `needle = ANY(haystack)` using 
`ast::Expr::AnyOp`.
   
   ### Describe alternatives you've considered
   
   The `@>` containment operator (`haystack @> ARRAY[needle]`) is another valid 
Postgres syntax, but `= ANY()` is more conventional for single-element checks 
and maps directly to the `AnyOp` AST node.
   
   ### Additional context
   
   N/A


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to