Hello! Is there any way to create connection in ArcGIS Online for PostgreSQL spatial database?
Usually not directly. You have "publish" something from the PostgreSQL database that is accessible to Online, like a map / feature service. This can be done with ArcGIS Server or ArcGIS Enterprise.
Is the "goal" to connect your local PostgreSQL DB to Online?
I looked at Data Pipelines and Velocity (both hosted in ArcGIS Online), but direct connection to PostgreSQL is not supported: