<@U04S8PLJWMT> I;m getting pg connection issues in...
# ask-ai
a
@kapa.ai I;m getting pg connection issues in temporal but working file in bootloader TEMPORAL_ADDRESS is not set, setting it to 10.144.1.46:7233 PostgreSQL started. Setup PostgreSQL schema. 2025-08-12T130111.159Z
k
When you encounter PostgreSQL connection issues with Temporal while the Airbyte bootloader connects fine, it often points to differences in configuration, permissions, or environment between the two services. Based on the knowledge sources, here are the most common causes and solutions: 1. Database Permissions and Existence Temporal requires the
temporal
and
temporal_visibility
databases to exist and for the connecting user to have sufficient privileges. If the user does not have permission to create databases, you must manually create them and grant all privileges to the Airbyte user. For example:
Copy code
sql    create database temporal;    grant all privileges on database temporal to airbyte;     create database temporal_visibility;    grant all privileges on database temporal_visibility to airbyte;
If these databases already exist, ensure the user has the correct permissions. Otherwise, Temporal will fail to connect or set up the schema, even if the bootloader works fine because it uses a different database or user context [Forum: Unable to create SQL database](https://discuss.airbyte.io/t/1544) [Forum: Kubernetes: temporal: Cannot start with empty DBs already created](https://discuss.airbyte.io/t/4432). 2. SSL/TLS Requirements Some managed Postgres services (like Azure or AWS RDS) require SSL/TLS connections. If Temporal is not configured to use SSL, it will fail to connect, even if the bootloader (which may use different connection settings) works. You may need to set environment variables such as:
Copy code
SQL_TLS=true    SQL_TLS_ENABLED=true    SQL_TLS_DISABLE_HOST_VERIFICATION=true
This has resolved similar issues for others, especially with newer Temporal images or managed Postgres services [Github: Temporal v1.23.0 fails to start](https://github.com/airbytehq/airbyte/issues/38593) [Forum: [Kubernetes] Temporal deployment failing to connect with External Azure Postgres DB](https://discuss.airbyte.io/t/2928). 3. pg_hba.conf and Network Access If you see errors about
no pg_hba.conf entry
, it means the Postgres server is not allowing connections from the Temporal pod’s IP, user, or database. You must update your Postgres
pg_hba.conf
to allow the Temporal service to connect, matching the user and database [Github: Unable to start server. Error: sql schema version compatibility check failed](https://github.com/airbytehq/airbyte/issues/26647). 4. Container/Pod Environment Differences Sometimes, environment variables or secrets are not set correctly in the Temporal container, even if they are for the bootloader. Double-check that all relevant environment variables (host, port, user, password, SSL settings) are set identically for both services. Summary: - Ensure the
temporal
and
temporal_visibility
databases exist and the user has full privileges. - Set SSL/TLS environment variables if your Postgres requires it. - Check your Postgres
pg_hba.conf
and firewall rules. - Verify all environment variables are set correctly in the Temporal deployment. If you provide the exact error message from the Temporal logs, I can help further narrow down the issue.
a
@kapa.ai Will these temporal DBs not created automatically?
k
A message from kapa.ai
By default, Temporal (as deployed with Airbyte) will attempt to create the
temporal
and
temporal_visibility
databases automatically if they do not exist. However, this requires that the database user configured for Temporal has the necessary permissions to create new databases. If the user does not have these permissions, the creation will fail, and you will see errors such as “permission denied to create database” in the logs. In environments where the user does not have database creation privileges (common in managed or production databases), you must manually create the
temporal
and
temporal_visibility
databases and grant the required privileges to the Airbyte user. This is a common requirement and is documented in several user reports and official answers: > The issue was that I created a new user in our Postgres server and configured Airbyte to use this. This user however does not have permission to create new databases. This causes an issue when starting Airbyte for the first time as Airbyte expects to find databases called
temporal
and
temporal_visibility
. If these do not exist then Airbyte tries to create them. > The solution was to manually create the databases called
temporal
and
temporal_visibility
in our Postgres server and assign permissions to the Airbyte user [Forum: Unable to create SQL database](https://discuss.airbyte.io/t/1544). So, the Temporal databases will be created automatically only if the configured user has the necessary permissions. Otherwise, you must create them manually and grant the appropriate privileges.
a
@kapa.ai how to see which user is configured for temporal?
k
A message from kapa.ai
To see which user is configured for Temporal in your Airbyte deployment, you need to check the environment variables or configuration files used by the Temporal service. The relevant environment variable is typically named
POSTGRES_USER
or
DATABASE_USER
, depending on your deployment method. For example, in a Kubernetes deployment, the Temporal container is often configured with environment variables like:
Copy code
yaml - name: POSTGRES_USER   valueFrom:     secretKeyRef:       key: DATABASE_USER       name: airbyte-temporal-secrets
Or, you might see:
Copy code
yaml - name: DATABASE_USER   value: airbyteuser
You can check your Kubernetes manifests (such as your
Deployment
or
StatefulSet
for Temporal) or the secrets referenced there to find the actual user being used. If you are using Docker Compose, look for the
DATABASE_USER
or
POSTGRES_USER
environment variable in your
docker-compose.yaml
file. If you are unsure, you can also inspect the running Temporal pod/container's environment variables directly using: - For Kubernetes:
Copy code
kubectl exec <temporal-pod-name> -- printenv | grep USER
- For Docker Compose:
Copy code
docker exec <temporal-container-name> printenv | grep USER
The knowledge sources confirm that the user is set via environment variables like
POSTGRES_USER
or
DATABASE_USER
in the Temporal deployment configuration [see example in this deployment spec](https://github.com/airbytehq/airbyte/issues/26647). If you do not see these variables set, check your secrets or config maps referenced in your deployment.