postgres updates

Postgres compatibility updates (NOTE: breaks without red 25d69a9 or newer due to db_getfunc())

fortunate excluded due to complexity (might not even be possible)
random_channel_home excluded due to deprecation