plutaniano opened a new issue, #50976: URL: https://github.com/apache/airflow/issues/50976
### Apache Airflow Provider(s) postgres ### Versions of Apache Airflow Providers apache-airflow-providers-postgres==6.1.3 ### Apache Airflow version 2.11.0 ### Operating System Debian GNU/Linux 12 (bookworm) ### Deployment Official Apache Airflow Helm Chart ### Deployment details _No response_ ### What happened The changes introduced by https://github.com/apache/airflow/pull/49120 made PostgresHook ignore custom adapters registered via `psycopg2.extensions.register_adapter` for the `dict` and `list` types. Code that relied on custom adapters for `dict`s and `list`s is now broken because `PostgresHook._serialize_cell` is changing their type from `dict` or `list` to `Json`, making psycopg2 ignore the custom adapters registered for `dict`s and `list`s. Automatically using `Json` to adapt `list` is a specially bad case because it prevents users from adapting python's `list[int]` or `list[str]` to postgres' `int[]` or `text[]`. ### What you think should happen instead I don't think PostgresHook should introduce a special case when serialing `dict` and `list` values and it should respect the custom adapters registered using the `register_adapter` [mechanism provided by psycopg2](https://www.psycopg.org/docs/extensions.html#psycopg2.extensions.register_adapter). ### How to reproduce Using `apache-airflow-providers-postgres==6.1.3`, register a custom adapter for `dict` or `list` using `psycopg2.extensions.register_adapter` and try to run a query which adapts a `dict` or `list`. The adapter will never be called. ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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]
