Database troubleshooting

PostgreSQL gateway setup and troubleshooting

Check PostgreSQL host reachability, Npgsql/provider prerequisites, database grants, schema access, SSL settings, and table primary keys before building PostgreSQL action templates.

PostgreSQLMedium

Use this guide when

  • PostgreSQL connection test failed
  • Table list does not load
  • PostgreSQL works in pgAdmin but not through gateway
  • Generated PostgreSQL row actions need a reliable test environment

Prerequisites

  • PostgreSQL service is reachable from the gateway machine, usually on port 5432.
  • The required PostgreSQL provider/driver is installed on the gateway host when the connector requires it.
  • The database user has CONNECT, USAGE on schema, and table-level SELECT/INSERT/UPDATE/DELETE as needed.
  • Tables used by row operations have a primary key.

Fast checks before you debug

  • Use the gateway host perspective for server names and localhost.
  • If pgAdmin works on your laptop, repeat the test from the gateway machine.
  • Schema permissions matter; table grants alone are not always enough.
  • Restart the gateway after installing or updating Npgsql/provider components.

Step-by-step diagnostics

Test PostgreSQL port reachability

Run the port test from the gateway host. If it fails, check PostgreSQL listen_addresses, pg_hba.conf, DNS, and firewall rules.

Test-NetConnection <postgres-server-name-or-ip> -Port 5432
Test with psql using the same account

Use the same server, database, username, and SSL expectation that Power Automate will use.

psql -h <server> -p 5432 -U <user> -d <database> -c "select current_user, current_database();"
Grant database and schema permissions

If the connection succeeds but tables do not appear, verify schema usage and table privileges for the Power Automate user.

GRANT CONNECT ON DATABASE flowmigrator_postgres_lab TO flowmigrator_postgres_user;
GRANT USAGE ON SCHEMA public TO flowmigrator_postgres_user;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO flowmigrator_postgres_user;
Verify gateway provider prerequisites

If Power Automate errors mention a missing provider or driver, install the PostgreSQL/Npgsql provider required by the connector on the gateway machine and restart the gateway service.

Restart-Service PBIEgwService

Common errors and fixes

Connection succeeds but no tables are visible.
Likely cause
The user lacks schema USAGE or table SELECT privileges.
Fix
Grant CONNECT on database, USAGE on schema, and table permissions. Then recreate or refresh the connection.
Power Automate fails but pgAdmin works.
Likely cause
pgAdmin was tested from a different machine or with a different host/SSL/user combination.
Fix
Run psql or pgAdmin from the gateway machine using the exact connection values.
Provider or driver error after setup.
Likely cause
Required PostgreSQL provider is missing, wrong architecture, or not loaded by the gateway service.
Fix
Install the connector prerequisite provider on the gateway host and restart PBIEgwService.

Power Automate connection fields

FieldUse this value
ServerGateway-reachable PostgreSQL host name or IP.
DatabaseExact database name.
UsernameDatabase user with schema and table grants.
GatewayGateway host with required PostgreSQL provider installed if needed.

Validation checklist

  • Port 5432 is reachable from the gateway host.
  • psql succeeds from the gateway host using the Power Automate user.
  • The Power Automate user can list and query the intended schema/table.
  • Primary keys exist for tables used by row actions.
  • Gateway service was restarted after provider installation or changes.

Related gateway guides