Skip to content

Commit 4672719

Browse files
committed
Fix error in handling of RESET ALL
1 parent 42811e3 commit 4672719

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

src/loader/loader.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,16 @@ should_load_on_variable_set(Node *utility_stmt)
9999
{
100100
VariableSetStmt *stmt = (VariableSetStmt *) utility_stmt;
101101

102-
/* Do not load when setting the guc */
103-
return strcmp(stmt->name, GUC_DISABLE_LOAD_NAME) != 0;
102+
switch (stmt->kind)
103+
{
104+
case VAR_SET_VALUE:
105+
case VAR_SET_DEFAULT:
106+
case VAR_RESET:
107+
/* Do not load when setting the guc to disable load */
108+
return stmt->name == NULL || strcmp(stmt->name, GUC_DISABLE_LOAD_NAME) != 0;
109+
default:
110+
return true;
111+
}
104112
}
105113

106114
static bool

test/expected/loader.out

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,48 @@ SET timescaledb.disable_load = 'not bool';
154154
WARNING: mock post_analyze_hook "mock-1"
155155
ERROR: parameter "timescaledb.disable_load" requires a Boolean value
156156
\set ON_ERROR_STOP 1
157+
\c single :ROLE_SUPERUSER
158+
RESET ALL;
159+
WARNING: mock init "mock-1"
160+
WARNING: mock post_analyze_hook "mock-1"
161+
SELECT 1;
162+
WARNING: mock post_analyze_hook "mock-1"
163+
?column?
164+
----------
165+
1
166+
(1 row)
167+
168+
\c single :ROLE_SUPERUSER
169+
SET timescaledb.disable_load TO DEFAULT;
170+
SELECT 1;
171+
WARNING: mock init "mock-1"
172+
WARNING: mock post_analyze_hook "mock-1"
173+
?column?
174+
----------
175+
1
176+
(1 row)
177+
178+
\c single :ROLE_SUPERUSER
179+
RESET timescaledb.disable_load;
180+
SELECT 1;
181+
WARNING: mock init "mock-1"
182+
WARNING: mock post_analyze_hook "mock-1"
183+
?column?
184+
----------
185+
1
186+
(1 row)
187+
188+
\c single :ROLE_SUPERUSER
189+
SET timescaledb.other = 'on';
190+
WARNING: mock init "mock-1"
191+
WARNING: mock post_analyze_hook "mock-1"
192+
SELECT 1;
193+
WARNING: mock post_analyze_hook "mock-1"
194+
?column?
195+
----------
196+
1
197+
(1 row)
198+
157199
\set ON_ERROR_STOP 0
158200
--cannot update extension after .so of previous version already loaded
159201
ALTER EXTENSION timescaledb UPDATE TO 'mock-2';

test/sql/loader.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ SELECT 1;
5252
SET timescaledb.disable_load = 'not bool';
5353
\set ON_ERROR_STOP 1
5454

55+
\c single :ROLE_SUPERUSER
56+
RESET ALL;
57+
SELECT 1;
58+
59+
\c single :ROLE_SUPERUSER
60+
SET timescaledb.disable_load TO DEFAULT;
61+
SELECT 1;
62+
63+
\c single :ROLE_SUPERUSER
64+
RESET timescaledb.disable_load;
65+
SELECT 1;
66+
67+
\c single :ROLE_SUPERUSER
68+
SET timescaledb.other = 'on';
69+
SELECT 1;
5570

5671
\set ON_ERROR_STOP 0
5772
--cannot update extension after .so of previous version already loaded

0 commit comments

Comments
 (0)