Is there a way to connect to the Spanner Emulator through a PGAdapter? I want to develop an application with PostgreSQL Dialect database.
EDIT 2024-01-17:
The Cloud Spanner Emulator supports the PostgreSQL dialect, and PGAdapter can also connect to the emulator. The simplest way to use PGAdapter with the emulator is to use the combined Docker image that contains both PGAdapter and the Emulator, and that has PGAdapter configured to connect to the emulator, and to automatically create any instance or database that is referenced in any incoming connection request. The latter makes it very easy to use for testing, as you don't have to worry about creating an instance and a database first.
Use it like this:
docker pull gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator
docker run \
-d -p 5432:5432 \
gcr.io/cloud-spanner-pg-adapter/pgadapter-emulator
sleep 2
psql -h localhost -p 5432 -d test-database
More information can be found here: https://github.com/GoogleCloudPlatform/pgadapter?tab=readme-ov-file#emulator
OLD ANSWER:
The Cloud Spanner emulator does not yet support the PostgreSQL dialect. PGAdapter can currently only be used with PostgreSQL-dialect Cloud Spanner databases, which means that even though you can connect to the emulator using PGAdapter, it would refuse to connect to any database on that emulator, because they use the GoogleSQL dialect. For the time being, the recommendation is to use either one of the following options for development instances: