From ea9f6aaebdc7f100bf1840c9345d75ed15c5fb10 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Tue, 29 Oct 2024 16:02:08 +0500 Subject: [PATCH] connected --- src/diskquota_utility.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/diskquota_utility.c b/src/diskquota_utility.c index 57a644f5..7e036e55 100644 --- a/src/diskquota_utility.c +++ b/src/diskquota_utility.c @@ -1663,10 +1663,13 @@ SPI_connect_wrapper(SPI_state *state) StartTransactionCommand(); state->is_under_transaction = true; } - if ((rc = SPI_connect()) != SPI_OK_CONNECT) - ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("[diskquota] SPI_connect failed"), - errdetail("%s", SPI_result_code_string(rc)))); - state->is_connected = true; + if (!SPI_context()) + { + if ((rc = SPI_connect()) != SPI_OK_CONNECT) + ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("[diskquota] SPI_connect failed"), + errdetail("%s", SPI_result_code_string(rc)))); + state->is_connected = true; + } if (state->is_under_transaction) { PushActiveSnapshot(GetTransactionSnapshot());