mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Add an additional hook for EXPLAIN option validation.
Commit c65bc2e1d1
made it possible for
loadable modules to add EXPLAIN options. Normally, any necessary
validation can be performed by the hook function passed to
RegisterExtensionExplainOption, but if a loadable module wants to sanity
check options against each other, that needs to be done after the entire
options list has been processed. So, add an additional hook for that
purpose.
Author: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CAA5RZ0vOcJF91O2e5AQN+V6guMNLMhJx83dxALf-iUZ-hLGO_Q@mail.gmail.com
This commit is contained in:
@ -37,6 +37,9 @@
|
||||
#include "commands/explain.h"
|
||||
#include "commands/explain_state.h"
|
||||
|
||||
/* Hook to perform additional EXPLAIN options validation */
|
||||
explain_validate_options_hook_type explain_validate_options_hook = NULL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *option_name;
|
||||
@ -196,6 +199,10 @@ ParseExplainOptionList(ExplainState *es, List *options, ParseState *pstate)
|
||||
|
||||
/* if the summary was not set explicitly, set default value */
|
||||
es->summary = (summary_set) ? es->summary : es->analyze;
|
||||
|
||||
/* plugin specific option validation */
|
||||
if (explain_validate_options_hook)
|
||||
(*explain_validate_options_hook) (es, options, pstate);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -78,6 +78,11 @@ typedef struct ExplainState
|
||||
|
||||
typedef void (*ExplainOptionHandler) (ExplainState *, DefElem *, ParseState *);
|
||||
|
||||
/* Hook to perform additional EXPLAIN options validation */
|
||||
typedef void (*explain_validate_options_hook_type) (struct ExplainState *es, List *options,
|
||||
ParseState *pstate);
|
||||
extern PGDLLIMPORT explain_validate_options_hook_type explain_validate_options_hook;
|
||||
|
||||
extern ExplainState *NewExplainState(void);
|
||||
extern void ParseExplainOptionList(ExplainState *es, List *options,
|
||||
ParseState *pstate);
|
||||
|
Reference in New Issue
Block a user