Skip to content

Commit 594f617

Browse files
committed
fix crash on RESET ALL (issue #121)
1 parent fc365c5 commit 594f617

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

expected/pathman_calamity.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,25 @@ NOTICE: drop cascades to 2 other objects
855855
DROP SCHEMA calamity CASCADE;
856856
NOTICE: drop cascades to 15 other objects
857857
DROP EXTENSION pg_pathman;
858+
/*
859+
* -------------------------------
860+
* Special tests (SET statement)
861+
* -------------------------------
862+
*/
863+
CREATE EXTENSION pg_pathman;
864+
SET pg_pathman.enable = false;
865+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
866+
SET pg_pathman.enable = true;
867+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
868+
SET pg_pathman.enable = false;
869+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
870+
RESET pg_pathman.enable;
871+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
872+
RESET ALL;
873+
BEGIN; ROLLBACK;
874+
BEGIN ISOLATION LEVEL SERIALIZABLE; ROLLBACK;
875+
BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; ROLLBACK;
876+
DROP EXTENSION pg_pathman;
858877
/*
859878
* -------------------------------------
860879
* Special tests (pathman_cache_stats)

sql/pathman_calamity.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,27 @@ DROP EXTENSION pg_pathman;
369369

370370

371371

372+
/*
373+
* -------------------------------
374+
* Special tests (SET statement)
375+
* -------------------------------
376+
*/
377+
378+
CREATE EXTENSION pg_pathman;
379+
380+
SET pg_pathman.enable = false;
381+
SET pg_pathman.enable = true;
382+
SET pg_pathman.enable = false;
383+
RESET pg_pathman.enable;
384+
RESET ALL;
385+
BEGIN; ROLLBACK;
386+
BEGIN ISOLATION LEVEL SERIALIZABLE; ROLLBACK;
387+
BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; ROLLBACK;
388+
389+
DROP EXTENSION pg_pathman;
390+
391+
392+
372393
/*
373394
* -------------------------------------
374395
* Special tests (pathman_cache_stats)

src/xact_handling.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,15 @@ xact_is_set_stmt(Node *stmt, const char *name)
125125
if (!IsA(stmt, VariableSetStmt))
126126
return false;
127127

128-
if (!name || pg_strcasecmp(name, ((VariableSetStmt *) stmt)->name) == 0)
128+
if (!name)
129129
return true;
130+
else
131+
{
132+
char *set_name = ((VariableSetStmt *) stmt)->name;
133+
134+
if (set_name && pg_strcasecmp(name, set_name) == 0)
135+
return true;
136+
}
130137

131138
return false;
132139
}

0 commit comments

Comments
 (0)