Type array_agg()
The return type of `array_agg()` is declared as a `Sequence[T]` where `T` is bound to the type of input argument.
This is implemented by making `array_agg()` inheriting from `ReturnTypeFromArgs` which provides appropriate overloads of `__init__()` to support this.
This usage of ReturnTypeFromArgs is a bit different from previous ones as the return type of the function is not exactly the same as that of its arguments, but a "collection" (a generic, namely a Sequence here) of the argument types. Accordingly, we adjust the code of `tools/generate_sql_functions.py` to retrieve the "collection" type from 'fn_class' annotation and generate expected return type.
Also add a couple of hand-written typing tests for PostgreSQL.
Related to #6810
Closes: #12461
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12461
Pull-request-sha:
ba27cbb8639dcd35127ab6a2928b7b5b3667e287
Change-Id: I3fd538cc7092a0492c26970f0b825bf70ddb66cd
(cherry picked from commit
543acbd8d1c7e3037877ca74a6b05f62592ef153)