无效的表值函数 EXTERNAL_QUERY 连接到 PostgreSQL 服务器失败:服务器意外关闭了连接

Pav*_*vel 2 postgresql google-cloud-sql google-bigquery google-cloud-platform

我需要执行从 BigQuery 到 Postgres 实例的外部查询。我已经在同一区域(法兰克福)的 BigQuery 端设置了一个具有公共 IP 和外部连接的 Postgres 实例。

每当我尝试执行测试查询时,都会收到以下错误:

Invalid table-valued function EXTERNAL_QUERY Connect to PostgreSQL server failed: server closed the connection unexpectedly
This probably means the server terminated abnormally before or while processing the request. at [1:15]
Run Code Online (Sandbox Code Playgroud)

有趣的是,类似的设置在另一个项目中运行良好。我不明白有什么区别。Postgres的错误日志中没有任何记录。

我该如何调试正在发生的事情?

Pav*_*vel 7

service-<projectNumber>@gcp-sa-bigqueryconnection.iam.gserviceaccount.com正如 @kiranmathew 所建议的,缺少服务帐户。我尝试打开和关闭 BigQuery 连接 API,但帐户没有出现。因此,我手动将其添加到BigQuery Connection Service Agent角色中,然后我从 GCP 控制台进行的查询开始工作。