From 432087f8b4173237b62f361b4eb13c6722495463 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Fri, 9 Oct 2026 14:43:21 +0300 Subject: [PATCH] fix(pg): closing a sequence or routine view releases its lease without interrupting the shared session (#1215) Closing the sequence or routine view while it was loading interrupted the read-only session of the database: the same shared session the tree, the table tabs, the Relations view and MCP use. Those views now only release their lease, as the table browser does since #1215. --- lib/features/postgresql/postgres_routine_view.dart | 13 ++++--------- lib/features/postgresql/postgres_sequence_view.dart | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/features/postgresql/postgres_routine_view.dart b/lib/features/postgresql/postgres_routine_view.dart index 36af6bf4..be35ce52 100644 --- a/lib/features/postgresql/postgres_routine_view.dart +++ b/lib/features/postgresql/postgres_routine_view.dart @@ -61,18 +61,13 @@ class _PostgresRoutineViewState extends material.State { } _definitionControllers.clear(); _scrollController.dispose(); - _disconnectCurrent(interruptIfBusy: true); + _disconnectCurrent(); super.dispose(); } - void _disconnectCurrent({bool interruptIfBusy = false}) { - if (interruptIfBusy && _loading) { - PostgresService.instance.interrupt( - widget.connectionRow, - database: widget.database, - mode: PgSessionMode.readOnly, - ); - } + /// Releases the lease. The session is shared with the tree, the table tabs + /// and MCP, so closing this view never interrupts it. + void _disconnectCurrent() { _lease?.release(); _lease = null; } diff --git a/lib/features/postgresql/postgres_sequence_view.dart b/lib/features/postgresql/postgres_sequence_view.dart index 08083997..5dfeb6bb 100644 --- a/lib/features/postgresql/postgres_sequence_view.dart +++ b/lib/features/postgresql/postgres_sequence_view.dart @@ -53,18 +53,13 @@ class _PostgresSequenceViewState extends material.State { @override void dispose() { _scrollController.dispose(); - _disconnectCurrent(interruptIfBusy: true); + _disconnectCurrent(); super.dispose(); } - void _disconnectCurrent({bool interruptIfBusy = false}) { - if (interruptIfBusy && _loading) { - PostgresService.instance.interrupt( - widget.connectionRow, - database: widget.database, - mode: PgSessionMode.readOnly, - ); - } + /// Releases the lease. The session is shared with the tree, the table tabs + /// and MCP, so closing this view never interrupts it. + void _disconnectCurrent() { _lease?.release(); _lease = null; }