Skip to content

Commit

Permalink
fix show_plan gucs
Browse files Browse the repository at this point in the history
  • Loading branch information
KushaalShroff committed Nov 26, 2024
1 parent 2e77395 commit d17cf0f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contrib/babelfishpg_tsql/src/pl_exec-2.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,17 @@ exec_stmt_exec(PLtsql_execstate *estate, PLtsql_stmt_exec *stmt)
else
estate->schema_name = NULL;

/*
* We need to disable the explain gucs incase of sp_reset_connection
* execution otherwise we will get explain output for it which is
* not intended.
*/
if (strcmp(stmt->proc_name, "sp_reset_connection") == 0)
{
pltsql_explain_only = false;
pltsql_explain_analyze = false;
}

/* PG_TRY to ensure we clear the plan link, if needed, on failure */
PG_TRY();
{
Expand Down
3 changes: 3 additions & 0 deletions contrib/babelfishpg_tsql/src/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "dbcmds.h"
#include "multidb.h"
#include "session.h"
#include "pl_explain.h"
#include "pltsql.h"
#include "guc.h"
#include "storage/shm_toc.h"
Expand Down Expand Up @@ -202,6 +203,8 @@ reset_session_properties(void)
{
reset_cached_batch();
reset_cached_cursor();
pltsql_explain_only = false;
pltsql_explain_analyze = false;
}

void
Expand Down

0 comments on commit d17cf0f

Please sign in to comment.