You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PdoPostgresAdapter owes the PostgreSQL reconnect-after-drop port (follow-up to #244) #245
PdoPostgresAdapter owes the PostgreSQL reconnect-after-drop port (follow-up to #244)
#244 brought PostgreSQL reconnect-after-drop to parity across the four frameworks' PRIMARY
adapters (Python #243, Node tina4stack/tina4-nodejs#163, Ruby tina4stack/tina4-ruby#143, and PHP's
ext-pgsql PostgresAdapter in #319, with negative tests in #320).
PHP has a SECOND adapter, Tina4/Database/PdoPostgresAdapter.php, used only as a fallback when
ext-pgsql (pg_connect) is absent but the pdo_pgsql PDO driver is present (see Database::makePostgres). It still never re-establishes a dropped link.
To do (mirror #319 / the Python master)
Rebuild a dead link before a statement runs on it (never inside an explicit transaction).
Reconnect + retry once on a dropped-link error when no transaction owns the link; a failed
reconnect leaves the link closed so the next statement recovers.
Surface transaction-control failures raw (no reconnect), and clear the in-transaction flag even
if COMMIT/ROLLBACK fails on a dead link.
Real-PostgreSQL regression tests incl. the negatives from #320 (no mocks), gated by forcing the
pdo_pgsql path (ext-pgsql unavailable) in the test environment.
Done in tina4stack/tina4-php#328 (merged to v3). PdoPostgresAdapter now reconnects after a dropped link — reactive reconnect in PdoAdapterTrait gated by a per-adapter connectionWasLost() hook (PG overrides it; SQLite/others unchanged), with the explicit-transaction gate cleared in a finally so a failed ROLLBACK can't wedge recovery. Mutation-proven by PdoPostgresReconnectTest on a real PostgreSQL (pg_terminate_backend, no mocks): positive + negative cases, red before the fix, green after. PostgreSQL reconnect-after-drop is now at full parity including PHP's PDO fallback.
Activity
tina4stack commentedon Oct 22, 2026
Done in tina4stack/tina4-php#328 (merged to v3). PdoPostgresAdapter now reconnects after a dropped link — reactive reconnect in PdoAdapterTrait gated by a per-adapter connectionWasLost() hook (PG overrides it; SQLite/others unchanged), with the explicit-transaction gate cleared in a finally so a failed ROLLBACK can't wedge recovery. Mutation-proven by PdoPostgresReconnectTest on a real PostgreSQL (pg_terminate_backend, no mocks): positive + negative cases, red before the fix, green after. PostgreSQL reconnect-after-drop is now at full parity including PHP's PDO fallback.