File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 46
46
*
47
47
*****************************************************************************/
48
48
49
+ #define CREATE_EXTENSION_STARTSTRING_0 \
50
+ "-- complain if script is sourced in psql, rather than via CREATE EXTENSION"
51
+ #define CREATE_EXTENSION_STARTSTRING_1 \
52
+ "SELECT 1 FROM ONLY \"public\".\"aqo_queries\" x WHERE \"query_hash\"\
53
+ OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x"
54
+
49
55
static const char * query_text ;
50
56
51
57
/*
@@ -94,8 +100,12 @@ aqo_planner(Query *parse,
94
100
95
101
selectivity_cache_clear ();
96
102
97
- if (parse -> commandType != CMD_SELECT && parse -> commandType != CMD_INSERT &&
98
- parse -> commandType != CMD_UPDATE && parse -> commandType != CMD_DELETE )
103
+ if ((parse -> commandType != CMD_SELECT && parse -> commandType != CMD_INSERT &&
104
+ parse -> commandType != CMD_UPDATE && parse -> commandType != CMD_DELETE ) ||
105
+ strncmp (query_text , CREATE_EXTENSION_STARTSTRING_0 ,
106
+ strlen (CREATE_EXTENSION_STARTSTRING_0 )) == 0 ||
107
+ strncmp (query_text , CREATE_EXTENSION_STARTSTRING_1 ,
108
+ strlen (CREATE_EXTENSION_STARTSTRING_1 )) == 0 )
99
109
{
100
110
disable_aqo_for_query ();
101
111
return call_default_planner (parse , cursorOptions , boundParams );
You can’t perform that action at this time.
0 commit comments