PGAdapter は、起動時に指定された認証情報を調べて、接続に使用するサービス アカウントまたは他の Identity and Access Management(IAM)プリンシパルを決定します。そのプリンシパルに付与された IAM 権限によって、接続するアプリケーションがデータベースに対して持つ権限が決定されます。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-05 UTC。"],[],[],null,["# PGAdapter overview\n\nThis page provides an overview of PGAdapter. To learn how to start PGAdapter,\nsee [Starting PGAdapter](/spanner/docs/pgadapter-start).\n\nPGAdapter is a sidecar proxy which is a small application that runs\nalongside your main application to support communications between the [PostgreSQL interface for Spanner](/spanner/docs/postgresql-interface) and Spanner.\nFor Java applications you can even link PGAdapter to the application\ndirectly without having to run it in a separate process. PGAdapter is\ndesigned to run on the same machine as the application and exposes an\nendpoint on localhost that supports the PostgreSQL wire protocol. It\ntranslates the PostgreSQL wire protocol into the Spanner wire\nprotocol, gRPC. With this proxy running locally, a PostgreSQL client\nsuch as `psql` can connect to a PostgreSQL-dialect Spanner\ndatabase.\n\nPGAdapter adds, at most, 0.2 ms of latency overhead. The\nPostgreSQL interface has the same latency levels as\nGoogleSQL.\n| **Note:** [PostgreSQL drivers and ORMs](/spanner/docs/drivers-overview#postgresql_drivers_and_orms) lists all clients that PGAdapter supports.\n\nThe following diagram shows how `psql` connects to Spanner through\nPGAdapter.\n\nPGAdapter supports basic and extended query modes, and\nsupports any data type that the PostgreSQL interface for Spanner supports.\n\nPGAdapter execution environments\n--------------------------------\n\nYou can run PGAdapter by using one of the following methods:\n\n- **Standalone**: PGAdapter is supplied as a JAR file and runs standalone in the JVM.\n- **Docker**. PGAdapter is also packaged as a Docker image.\n- **Cloud Run**: PGAdapter can be deployed as a sidecar proxy on Cloud Run.\n- **Sidecar proxy**: a typical use as a sidecar proxy is in a Kubernetes cluster.\n- **In-process**: your Java application code can use the supplied JAR file to create and start a PGAdapter instance.\n\nFor details about these methods, see\n[Start PGAdapter](/spanner/docs/pgadapter-start).\n\nAuthorization with PGAdapter\n----------------------------\n\nPGAdapter determines the service account or other Identity and Access Management\n(IAM) principal to use for the connection by examining the\ncredentials that you specify when you start it. The IAM\npermissions granted to that principal determine the permissions that the\nconnecting application has on the database.\n\nWhen fine-grained access control is in use, you can optionally specify a\ndatabase role when you start PGAdapter. If you specify a database role,\nthen PGAdapter uses fine-grained access control when it sends requests for queries\nand DML statements. This requires the IAM permission\n`spanner.databases.useRoleBasedAccess` and, for database roles other than\n`public`, the `spanner.databaseRoles.use` permission. The privileges granted to\nthe database role determine the operations that the connecting application can\nperform. If you don't specify a database role, then the database-level\npermissions that are granted to the IAM\nprincipal are used. To perform DDL statements, the principal must have the\n`spanner.databases.updateDdl` permission.\n\nFor more information, see [About fine-grained access control](/spanner/docs/fgac-about) and\n[Access control with IAM](/spanner/docs/iam).\n\nWhat's next\n-----------\n\n- [Start PGAdapter](/spanner/docs/pgadapter-start)\n- Learn more about the [PGAdapter GitHub repository](https://github.com/GoogleCloudPlatform/pgadapter).\n- Learn more about [PostgreSQL drivers and ORMs](/spanner/docs/drivers-overview#postgresql_drivers_and_orms) for a table of PostgreSQL drivers and ORMs that PGAdapter supports."]]