@@ -157,7 +157,7 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
157
157
{
158
158
Jsonb * out_jsonb ,
159
159
* out_jsonb2 ;
160
- int query_hash ;
160
+ Datum query_hash ;
161
161
Relation sr_plans_heap ,
162
162
sr_index_rel ;
163
163
HeapTuple tuple ;
@@ -223,12 +223,8 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
223
223
/* Make list with all _p functions and his position */
224
224
sr_query_walker ((Query * )parse ,& qp_context );
225
225
out_jsonb = node_tree_to_jsonb (parse ,sr_plan_fake_func , true);
226
- query_hash = DatumGetInt32 (DirectFunctionCall1 (jsonb_hash ,
227
- PointerGetDatum (out_jsonb )));
228
- ScanKeyInit (& key ,1 ,
229
- BTEqualStrategyNumber ,
230
- F_INT4EQ ,
231
- Int32GetDatum (query_hash ));
226
+ query_hash = DirectFunctionCall1 (jsonb_hash ,PointerGetDatum (out_jsonb ));
227
+ ScanKeyInit (& key ,1 ,BTEqualStrategyNumber ,F_INT4EQ ,query_hash );
232
228
233
229
/* Try to find already planned statement */
234
230
heap_lock = AccessShareLock ;
@@ -309,7 +305,7 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
309
305
bool nulls [Anum_sr_attcount ];
310
306
311
307
MemSet (nulls ,0 ,sizeof (nulls ));
312
- values [Anum_sr_query_hash - 1 ]= Int32GetDatum ( query_hash ) ;
308
+ values [Anum_sr_query_hash - 1 ]= query_hash ;
313
309
values [Anum_sr_plan_hash - 1 ]= plan_hash ;
314
310
values [Anum_sr_query - 1 ]= CStringGetTextDatum (query_text );
315
311
values [Anum_sr_plan - 1 ]= PointerGetDatum (out_jsonb2 );
@@ -318,15 +314,13 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
318
314
319
315
tuple = heap_form_tuple (sr_plans_heap -> rd_att ,values ,nulls );
320
316
simple_heap_insert (sr_plans_heap ,tuple );
321
-
322
- /* Make changes visible */
323
- CommandCounterIncrement ();
324
317
#if PG_VERSION_NUM >=100000
325
318
index_insert (sr_index_rel ,
326
319
values ,nulls ,
327
320
& (tuple -> t_self ),
328
321
sr_plans_heap ,
329
- UNIQUE_CHECK_NO ,BuildIndexInfo (sr_index_rel ));
322
+ UNIQUE_CHECK_NO ,
323
+ NULL );
330
324
#else
331
325
index_insert (sr_index_rel ,
332
326
values ,nulls ,