Skip to content

fix(postgres): use rustls connector in test_connection to support client certs and custom CA - #678

Open
adisusilayasa wants to merge 1 commit into
TabularisDB:mainfrom
adisusilayasa:fix/postgres-test-connection-tls
Open

fix(postgres): use rustls connector in test_connection to support client certs and custom CA#678
adisusilayasa wants to merge 1 commit into
TabularisDB:mainfrom
adisusilayasa:fix/postgres-test-connection-tls

Conversation

@adisusilayasa

Copy link
Copy Markdown
Contributor

Summary

Previously, PostgresDriver did not implement test_connection(), falling back to the default DatabaseDriver::test_connection() implementation which constructed a connection URL and connected via sqlx::AnyConnection.

This caused connection tests to fail for PostgreSQL databases requiring:

  1. mTLS client certificates (ssl_cert / ssl_key) — because sqlx connection string did not include client certificates, causing servers to reject with FATAL: connection requires a valid client certificate.
  2. Custom Root CAs (ssl_ca) — because sqlx on macOS uses the system keychain rather than honoring the user-supplied CA bundle in test_connection.

Changes

  • Override test_connection() on PostgresDriver to use tokio-postgres-rustls (build_postgres_configurations and build_postgres_tls_connector), ensuring the test connection path matches the query pool path and properly honors ssl_ca, ssl_cert, and ssl_key.

@kilo-code-bot

kilo-code-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • src-tauri/src/drivers/postgres/mod.rs

Reviewed by glm-5.2 · Input: 29.9K · Output: 5.4K · Cached: 295.9K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant