About PGAdapter

Stay organized with collections Save and categorize content based on your preferences.

This page provides an overview of PGAdapter. To learn how to start PGAdapter, see Starting PGAdapter.

PGAdapter is a sidecar proxy that supports the PostgreSQL interface for Cloud Spanner. It runs on the same machine as the application and exposes an endpoint on localhost that supports the PostgreSQL wire protocol. It translates the PostgreSQL wire protocol into the Cloud Spanner wire protocol, gRPC. With this proxy running locally, a PostgreSQL client such as psql can connect to a Cloud Spanner database.

The following diagram shows how psql connects to Cloud Spanner through PGAdapter.

psql connects to Cloud Spanner through PGAdapter

PGAdapter supports simple and extended query modes, and supports any data type that the PostgreSQL interface for Cloud Spanner supports.

PGAdapter execution environments

You can run PGAdapter by using one of the following methods:

  • Standalone. PGAdapter is supplied as a JAR file and runs standalone in the JVM.
  • Containerized. PGAdapter is also packaged as a Docker image.
  • In-process. Your Java application code can use the supplied JAR file to create and start a PGAdapter instance.

For details about these methods, see Starting PGAdapter.

PGAdapter limitations

The PostgreSQL SSL wire protocol isn't supported. (The gRPC wire protocol encrypts by default.)

What's next

  • COPY protocol
  • SSL (The gRPC wire protocol encrypts by default.)