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

Commit9531f66

Browse files
author
Artur Zakirov
committed
Fix error: relation public.sr_plans does not exist
1 parentec79217 commit9531f66

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎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`

‎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,7 +82,14 @@ 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
#ifPG_VERSION_NUM >=90600
8795
query_index_rel_oid=DatumGetObjectId(DirectFunctionCall1(to_regclass,PointerGetDatum(cstring_to_text("sr_plans_query_hash_idx"))));
@@ -90,6 +98,7 @@ PlannedStmt *sr_planner(Query *parse,
9098
#endif
9199
if (query_index_rel_oid==InvalidOid)
92100
{
101+
heap_close(sr_plans_heap,heap_lock);
93102
elog(WARNING,"Not found sr_plans_query_hash_idx index");
94103
returnstandard_planner(parse,cursorOptions,boundParams);
95104
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp