giving a
Fatal error: Call to undefined method Drupal\Core\Database\Driver\pgsql\Connection::exec() in ./core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php on line 220
$this->exec obviously can't work. It obviously didn't work from the beginning.
So having this fixed, I'm getting another exception:
Database d8 not found. The server reports the following message when attempting to create the database: SQLSTATE[42809]: Wrong object type: 7 ERROR: invalid locale name en_US_POSIX.utf8.
So Locale::getDefault() sometimes seems to return a locale that isn't supported at all on the machine. A lot of locale errors with PostgreSQL seem to stem from the locale not being installed on the machine. But en_US_POSIX which is a special case, that definitely can't work.
Didn't find exhaustive documentation about it apart from ICU Locale and PostgreSQL Character Set Support, so there might be even more character that might generally not be supported.
So IMHO we should at least single out 'en_US_POSIX' and map it to 'en_US' which should always be supported.
We could also generally try again with 'en_US' after catching an exception. But that would mean we're not getting any bug reports on this anymore, so I'd stick with a case-by-case solution until we have a real generic solution.