src/test/modules/delay_execution/delay_execution.c
static PlannedStmt *
delay_execution_planner(Query *parse, const char *query_string,
						int cursorOptions, ParamListInfo boundParams)
{
	PlannedStmt *result;

	/* Invoke the planner, possibly via a previous hook user */
	if (prev_planner_hook)
		result = prev_planner_hook(parse, query_string, cursorOptions,
								   boundParams);
	else
		result = standard_planner(parse, query_string, cursorOptions,
								  boundParams);

	/* If enabled, delay by taking and releasing the specified lock */
	if (post_planning_lock_id != 0)
	{
		DirectFunctionCall1(pg_advisory_lock_int8,
							Int64GetDatum((int64) post_planning_lock_id));
		DirectFunctionCall1(pg_advisory_unlock_int8,
							Int64GetDatum((int64) post_planning_lock_id));

		/*
		 * Ensure that we notice any pending invalidations, since the advisory
		 * lock functions don't do this.
		 */
		AcceptInvalidationMessages();
	}

	return result;
}
/* planner_hook function to provide the desired delay */
planner_hook function to provide the desired delay
planner_hook function to provide the desired delay
static PlannedStmt *
delay_execution_planner(Query *parse, const char *query_string,
						int cursorOptions, ParamListInfo boundParams)
{
	PlannedStmt *result;
	if (prev_planner_hook)
		result = prev_planner_hook(parse, query_string, cursorOptions,
								   boundParams);
	else
		result = standard_planner(parse, query_string, cursorOptions,
								  boundParams);
	if (post_planning_lock_id != 0)
	{
		DirectFunctionCall1(pg_advisory_lock_int8,
							Int64GetDatum((int64) post_planning_lock_id));
		DirectFunctionCall1(pg_advisory_unlock_int8,
							Int64GetDatum((int64) post_planning_lock_id));
		AcceptInvalidationMessages();
	}
	return result;
}
static PlannedStmt * delay_execution_planner ( Query * parse , const char * query_string , int cursorOptions , ParamListInfo boundParams ) { PlannedStmt * result ; if ( prev_planner_hook ) result = prev_planner_hook ( parse , query_string , cursorOptions , boundParams ) ; else result = standard_planner ( parse , query_string , cursorOptions , boundParams ) ; if ( post_planning_lock_id != 0 ) { DirectFunctionCall1 ( pg_advisory_lock_int8 , Int64GetDatum ( ( int64 ) post_planning_lock_id ) ) ; DirectFunctionCall1 ( pg_advisory_unlock_int8 , Int64GetDatum ( ( int64 ) post_planning_lock_id ) ) ; AcceptInvalidationMessages ( ) ; } return result ; }
planner_hook function to provide the desired delay
planner_hook function to provide the desired delay
/* Invoke the planner, possibly via a previous hook user */ /* If enabled, delay by taking and releasing the specified lock */ /*
		 * Ensure that we notice any pending invalidations, since the advisory
		 * lock functions don't do this.
		 */