Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit639f014

Browse files
author
Maksim Milyutin
committed
Refactor pathman_process_utility_callback
1 parent6187a4e commit639f014

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

‎src/hooks.c

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -755,24 +755,25 @@ pathman_relcache_hook(Datum arg, Oid relid)
755755
*/
756756
void
757757
#ifPG_VERSION_NUM >=100000
758-
pathman_process_utility_hook(PlannedStmt*pstmt,
758+
pathman_process_utility_hook(PlannedStmt*first_arg,
759759
constchar*queryString,
760760
ProcessUtilityContextcontext,
761761
ParamListInfoparams,
762762
QueryEnvironment*queryEnv,
763763
DestReceiver*dest,char*completionTag)
764764
{
765-
Node*parsetree=pstmt->utilityStmt;
766-
intstmt_location=pstmt->stmt_location,
767-
stmt_len=pstmt->stmt_len;
765+
Node*parsetree=first_arg->utilityStmt;
766+
intstmt_location=first_arg->stmt_location,
767+
stmt_len=first_arg->stmt_len;
768768
#else
769-
pathman_process_utility_hook(Node*parsetree,
769+
pathman_process_utility_hook(Node*first_arg,
770770
constchar*queryString,
771771
ProcessUtilityContextcontext,
772772
ParamListInfoparams,
773773
DestReceiver*dest,
774774
char*completionTag)
775775
{
776+
Node*parsetree=first_arg;
776777
intstmt_location=-1,
777778
stmt_len=0;
778779
#endif
@@ -825,27 +826,9 @@ pathman_process_utility_hook(Node *parsetree,
825826
}
826827
}
827828

828-
#ifPG_VERSION_NUM >=100000
829-
/* Call hooks set by other extensions if needed */
830-
if (process_utility_hook_next)
831-
process_utility_hook_next(pstmt,queryString,
832-
context,params,queryEnv,
833-
dest,completionTag);
834-
/* Else call internal implementation */
835-
else
836-
standard_ProcessUtility(pstmt,queryString,
837-
context,params,queryEnv,
838-
dest,completionTag);
839-
#else
840-
/* Call hooks set by other extensions if needed */
841-
if (process_utility_hook_next)
842-
process_utility_hook_next(parsetree,queryString,
843-
context,params,
844-
dest,completionTag);
845-
/* Else call internal implementation */
846-
else
847-
standard_ProcessUtility(parsetree,queryString,
848-
context,params,
849-
dest,completionTag);
850-
#endif
829+
/* 'first_arg' is PlannedStmt in pg10 or Node parsetree in pg9.6 and lower */
830+
call_process_utility_compat(
831+
(process_utility_hook_next) ?process_utility_hook_next :
832+
standard_ProcessUtility,
833+
first_arg,queryString,context,params,queryEnv,dest,completionTag);
851834
}

‎src/include/compat/pg_compat.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,28 @@
9797
#endif
9898

9999

100+
/*
101+
* call_process_utility_compat()
102+
*
103+
* the parameter 'first_arg' is:
104+
* - in pg 10 PlannedStmt object
105+
* - in pg 9.6 and lower Node parsetree
106+
*/
107+
#ifPG_VERSION_NUM >=100000
108+
#definecall_process_utility_compat(process_utility,first_arg,query_string, \
109+
context,params,query_env,dest, \
110+
completion_tag) \
111+
(process_utility)((first_arg), (query_string), (context), (params), \
112+
(query_env), (dest), (completion_tag))
113+
#elifPG_VERSION_NUM >=90500
114+
#definecall_process_utility_compat(process_utility,first_arg,query_string, \
115+
context,params,query_env,dest, \
116+
completion_tag) \
117+
(process_utility)((first_arg), (query_string), (context), (params), \
118+
(dest), (completion_tag))
119+
#endif
120+
121+
100122
/*
101123
* CatalogIndexInsert()
102124
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp