This could either be a flag that just checks that a single table exists:
wait4x postgres <connection string> --table-exists <table name>
Or pass a SQL command to run on the database once a connection has been established and verify the result somehow, maybe fail if the result is 0 or returns no data?
wait4x postgres <connection string> --sql "SELECT count(*) from migrations"
The use-case for this is that while a database might be up, it is not necessarily ready for an application to use if the schema has not been set up, data has not been seeded or migrations not yet run.