File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ converged_cq(double *elems, int nelems)
85
85
bool
86
86
is_in_infinite_loop_cq (double * elems , int nelems )
87
87
{
88
- if (nelems - auto_tuning_infinite_loop > auto_tuning_window_size + 2 )
88
+ if (nelems - auto_tuning_infinite_loop < auto_tuning_window_size + 2 )
89
89
return false;
90
90
91
91
return !converged_cq (elems , nelems ) &&
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