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

Commitd3e490a

Browse files
committed
handle inlined SQL functions in pathman_post_parse_analysis_hook()
1 parentfc9d807 commitd3e490a

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

‎src/hooks.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,7 @@ pathman_post_parse_analysis_hook(ParseState *pstate, Query *query)
516516
if (query->commandType==CMD_UTILITY&&
517517
(xact_is_transaction_stmt(query->utilityStmt)||
518518
xact_is_set_transaction_stmt(query->utilityStmt)))
519-
{
520519
return;
521-
}
522520

523521
/* Finish delayed invalidation jobs */
524522
if (IsPathmanReady())
@@ -532,6 +530,28 @@ pathman_post_parse_analysis_hook(ParseState *pstate, Query *query)
532530
{
533531
load_config();/* perform main cache initialization */
534532
}
533+
534+
/* Process inlined SQL functions (we've already entered planning stage) */
535+
if (IsPathmanReady()&&get_refcount_parenthood_statuses()>0)
536+
{
537+
/* Check that pg_pathman is the last extension loaded */
538+
if (post_parse_analyze_hook!=pathman_post_parse_analysis_hook)
539+
{
540+
char*spl_value;/* value of "shared_preload_libraries" GUC */
541+
542+
spl_value=GetConfigOptionByName("shared_preload_libraries",NULL, false);
543+
544+
ereport(ERROR,
545+
(errmsg("extension conflict has been detected"),
546+
errdetail("shared_preload_libraries = \"%s\"",spl_value),
547+
errhint("pg_pathman should be the last extension listed in "
548+
"\"shared_preload_libraries\" GUC in order to "
549+
"prevent possible conflicts with other extensions")));
550+
}
551+
552+
/* Modify query tree if needed */
553+
pathman_transform_query(query);
554+
}
535555
}
536556

537557
/*

‎src/planner_tree_modification.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,14 @@ incr_refcount_parenthood_statuses(void)
598598
per_table_parenthood_mapping_refcount++;
599599
}
600600

601+
/* Return current value of usage counter */
602+
uint32
603+
get_refcount_parenthood_statuses(void)
604+
{
605+
/* incr_refcount_parenthood_statuses() is called by pathman_planner_hook() */
606+
returnper_table_parenthood_mapping_refcount;
607+
}
608+
601609
/* Reset all cached statuses if needed (query end) */
602610
void
603611
decr_refcount_parenthood_statuses(boolentirely)

‎src/planner_tree_modification.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void assign_rel_parenthood_status(uint32 query_id, Oid relid,
4545
rel_parenthood_statusnew_status);
4646
rel_parenthood_statusget_rel_parenthood_status(uint32query_id,Oidrelid);
4747
voidincr_refcount_parenthood_statuses(void);
48+
uint32get_refcount_parenthood_statuses(void);
4849
voiddecr_refcount_parenthood_statuses(boolentirely);
4950

5051

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp