You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "vimeh (via GitHub)" <gi...@apache.org> on 2026/03/02 18:43:29 UTC

[I] Unparse array_has as = ANY() for PostgreSQL dialect [datafusion]

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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Unparse array_has as = ANY() for PostgreSQL dialect [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #20653: Unparse array_has as = ANY() for PostgreSQL dialect
URL: https://github.com/apache/datafusion/issues/20653


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org