Skip to content

fix(connections): keep one connection per database, no reconnect - #3271

Merged
datlechin merged 2 commits into
mainfrom
fix/database-switch-without-reconnect
Oct 6, 2026
Merged

datlechin merged 2 commits into
mainfrom
fix/database-switch-without-reconnect

Conversation

@datlechin

Copy link
Copy Markdown
Member

Why

Clicking between two database entries of one PostgreSQL connection reconnected every time: moveSessionOntoDatabase tore the session down and opened a new one. The database left lost its open transaction, temp tables and SET values silently, so a later COMMIT reported success for rolled-back writes. PostgreSQL cannot USE another database, but it can hold a second connection.

Change

  • Each database browsed from the strip keeps its own session connection (SessionLanes). Switching parks the one left and swaps in the target, with no reconnect. Closing the entry, a rename or drop, a rebuilt tunnel or a disconnect closes it.
  • A tab runs on its database's connection, not a pooled metadata one the Structure tab shared and the pool closed when idle.
  • A parked connection that died in a transaction is replaced; the next statement is refused once.
  • Import and Copy To join a transaction the user holds instead of committing it. PostgreSQL connections send TCP keepalives, and a ping no longer reconnects a session in a failed transaction.

Verified

SessionLanesTests covers switch, reuse, refusal, teardown and transaction loss. Live on PostgreSQL 17 with log_connections=on: three clicks between two entries opened and closed nothing.

Not in this PR

  • The database's catalog still reloads on each switch; keeping one per database is a follow-up.
  • No confirmation before closing an entry or disconnecting with an open transaction.
  • The website's PostgreSQL limit "Changing database means reconnecting" needs rewording at release.

Switching between database entries of one PostgreSQL, Redshift or
CockroachDB connection reopened the session each time, dropping the
open transaction, temp tables and SET values of the database left.
Each browsed database now keeps its own session connection, parked
while another is browsed and promoted back on return.
@mintlify

mintlify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
TablePro 🟢 Ready View Preview Oct 6, 2026, 12:51 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

Signed-off-by: Dat Ngo Quoc <datlechin@gmail.com>
@datlechin
datlechin merged commit 97d2ad2 into main Oct 6, 2026
11 checks passed
@datlechin
datlechin deleted the fix/database-switch-without-reconnect branch October 6, 2026 00:51

This branch was successfully deployed

1 active deployment
staging - docs — fda353fd Deployed Oct 6, 2026 by mintlify[bot]
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