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

Commitb04599c

Browse files
committed
Merge branch 'PGPRO9_6-PGPRO-203-sr_plan' into PGPRO9_6
2 parents70461ca +e80ac8e commitb04599c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎contrib/sr_plan/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ endif
2323

2424
genparser:
2525
#test -d sr_plan_env ||
26-
python gen_parser.py nodes.h `pg_config --includedir-server`
26+
python gen_parser.py nodes.h `$(PG_CONFIG) --includedir-server`

‎contrib/sr_plan/sr_plan.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ PlannedStmt *sr_planner(Query *parse,
6060
boolfind_ok= false;
6161
LOCKMODEheap_lock=AccessShareLock;
6262
Oidquery_index_rel_oid;
63+
Oidsr_plans_oid;
6364
IndexScanDescquery_index_scan;
6465
ScanKeyDatakey;
6566

@@ -81,11 +82,19 @@ PlannedStmt *sr_planner(Query *parse,
8182
sr_query_walker((Query*)parse,NULL);
8283

8384
sr_plans_table_rv=makeRangeVar("public","sr_plans",-1);
84-
sr_plans_heap=heap_openrv(sr_plans_table_rv,heap_lock);
85+
/* First check existance of "sr_plans" table */
86+
sr_plans_oid=RangeVarGetRelid(sr_plans_table_rv,heap_lock, true);
87+
if (!OidIsValid(sr_plans_oid))
88+
/* Just call standard_planner() if table doesn't exist. */
89+
returnstandard_planner(parse,cursorOptions,boundParams);
90+
91+
/* Table "sr_plans" exists */
92+
sr_plans_heap=heap_open(sr_plans_oid,NoLock);
8593

8694
query_index_rel_oid=DatumGetObjectId(DirectFunctionCall1(to_regclass,PointerGetDatum(cstring_to_text("sr_plans_query_hash_idx"))));
8795
if (query_index_rel_oid==InvalidOid)
8896
{
97+
heap_close(sr_plans_heap,heap_lock);
8998
elog(WARNING,"Not found sr_plans_query_hash_idx index");
9099
returnstandard_planner(parse,cursorOptions,boundParams);
91100
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp