add deparse_query hook.

This commit is contained in:
totaj
2023-12-07 16:06:17 +08:00
parent 01b191f057
commit 2cf2d5067e
3 changed files with 8 additions and 0 deletions

View File

@ -5806,6 +5806,11 @@ static void make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, i
void deparse_query(Query* query, StringInfo buf, List* parentnamespace, bool finalise_aggs, bool sortgroup_colno,
void* parserArg, bool qrw_phase, bool is_fqs)
{
if (u_sess->hook_cxt.deparseQueryHook != NULL) {
((deparse_query_func)(u_sess->hook_cxt.deparseQueryHook))(query, buf, parentnamespace,
finalise_aggs, sortgroup_colno, parserArg, qrw_phase, is_fqs);
return;
}
OverrideSearchPath* tmp_search_path = NULL;
List* schema_list = NIL;
ListCell* schema = NULL;

View File

@ -2878,6 +2878,7 @@ typedef struct knl_u_hook_context {
void *pluginSpiExecuteMultiResHook;
void *pluginMultiResExceptionHook;
void *getTypeZeroValueHook;
void *deparseQueryHook;
} knl_u_hook_context;
typedef struct knl_u_libsw_context {

View File

@ -914,6 +914,8 @@ extern char* deparse_alter_sequence(Node* stmt, bool owned_by_none = false);
extern void get_hint_string(HintState* hstate, StringInfo buf);
extern void deparse_query(Query* query, StringInfo buf, List* parentnamespace, bool finalise_aggs, bool sortgroup_colno,
void* parserArg = NULL, bool qrw_phase = false, bool is_fqs = false);
typedef void (*deparse_query_func)(Query* query, StringInfo buf, List* parentnamespace, bool finalise_aggs,
bool sortgroup_colno, void* parserArg, bool qrw_phase, bool is_fqs);
extern void deparse_targetlist(Query* query, List* targetList, StringInfo buf);
#endif
extern List* deparse_context_for(const char* aliasname, Oid relid);