Skip to content

Commit 2be97ce

Browse files
committed
fix drop extension case
1 parent 2e3c2cc commit 2be97ce

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

expected/joins.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,3 +1286,4 @@ DROP TABLE nt2 CASCADE;
12861286
NOTICE: drop cascades to constraint nt3_nt2_id_fkey on table nt3
12871287
DROP TABLE nt3 CASCADE;
12881288
DROP EXTENSION sr_plan CASCADE;
1289+
NOTICE: sr_plan was disabled

expected/sr_plan.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,5 @@ SELECT * FROM test_table WHERE test_attr1 = 15;
112112
(0 rows)
113113

114114
DROP EXTENSION sr_plan CASCADE;
115+
NOTICE: sr_plan was disabled
115116
DROP TABLE test_table;

sr_plan.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ init_sr_plan(void)
124124
* Check if 'stmt' is ALTER EXTENSION sr_plan
125125
*/
126126
static bool
127-
xact_is_alter_extension_stmt(Node *stmt)
127+
is_alter_extension_cmd(Node *stmt)
128128
{
129129
if (!stmt)
130130
return false;
@@ -139,7 +139,7 @@ xact_is_alter_extension_stmt(Node *stmt)
139139
}
140140

141141
static bool
142-
xact_is_drop_extension_stmt(Node *stmt)
142+
is_drop_extension_stmt(Node *stmt)
143143
{
144144
DropStmt *ds = (DropStmt *) stmt;
145145

@@ -150,7 +150,7 @@ xact_is_drop_extension_stmt(Node *stmt)
150150
return false;
151151

152152
if (ds->removeType == OBJECT_EXTENSION &&
153-
pg_strcasecmp(strVal(linitial(ds->objects)), "sr_plan"))
153+
pg_strcasecmp(strVal(linitial(ds->objects)), "sr_plan") == 0)
154154
return true;
155155

156156
return false;
@@ -171,15 +171,15 @@ sr_analyze(ParseState *pstate, Query *query)
171171
if (query->commandType == CMD_UTILITY)
172172
{
173173
/* ... ALTER EXTENSION sr_plan */
174-
if (xact_is_alter_extension_stmt(query->utilityStmt))
174+
if (is_alter_extension_cmd(query->utilityStmt))
175175
invalidate_oids();
176176

177177
/* ... DROP EXTENSION sr_plan */
178-
if (xact_is_drop_extension_stmt(query->utilityStmt))
178+
if (is_drop_extension_stmt(query->utilityStmt))
179179
{
180180
invalidate_oids();
181181
cachedInfo.enabled = false;
182-
elog(NOTICE, "sr_plan hooks were disabled");
182+
elog(NOTICE, "sr_plan was disabled");
183183
}
184184
}
185185
}

0 commit comments

Comments
 (0)