OSDN Git Service

試験項目作成中に修正した以下のバグを元に戻した。
authorMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Thu, 2 Aug 2012 02:50:32 +0000 (11:50 +0900)
committerMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Thu, 2 Aug 2012 02:50:32 +0000 (11:50 +0900)
EXECUTEコマンド実行時にエラー終了した場合に、外部変数に設定した
ステートメント名をNULLに設定していなかったために、その後通常の
クエリを発行すると、そのステートメント名でクエリ文字列を取得
しようとしてしまうバグを修正した。

expected/prepare-9.1.out
expected/prepare-9.2.out
pg_hint_plan.c
sql/prepare.sql

index 08e095d..66fb6ab 100644 (file)
@@ -653,21 +653,3 @@ EXPLAIN (COSTS false) EXECUTE p7 (10);
 /*+ NestLoop(t1 t2) */
 EXPLAIN (COSTS false) EXECUTE p8 (10);
 ERROR:  prepared statement "p8" does not exist
-/*+ NestLoop(t1 t2) */
-EXPLAIN (COSTS false) SELECT count(*) FROM t1, t2 WHERE t1.id = t2.id AND t1.id > 10;
-LOG:  pg_hint_plan:
-used hint:
-NestLoop(t1 t2)
-not used hint:
-duplication hint:
-error hint:
-
-                       QUERY PLAN                       
---------------------------------------------------------
- Aggregate
-   ->  Nested Loop
-         ->  Seq Scan on t2
-         ->  Index Scan using t1_pkey on t1
-               Index Cond: ((id > 10) AND (id = t2.id))
-(5 rows)
-
index 62f25b4..ed55e2a 100644 (file)
@@ -818,21 +818,3 @@ EXPLAIN (COSTS false) EXECUTE p7 (10);
 /*+ NestLoop(t1 t2) */
 EXPLAIN (COSTS false) EXECUTE p8 (10);
 ERROR:  prepared statement "p8" does not exist
-/*+ NestLoop(t1 t2) */
-EXPLAIN (COSTS false) SELECT count(*) FROM t1, t2 WHERE t1.id = t2.id AND t1.id > 10;
-LOG:  pg_hint_plan:
-used hint:
-NestLoop(t1 t2)
-not used hint:
-duplication hint:
-error hint:
-
-                       QUERY PLAN                       
---------------------------------------------------------
- Aggregate
-   ->  Nested Loop
-         ->  Seq Scan on t2
-         ->  Index Scan using t1_pkey on t1
-               Index Cond: ((id > 10) AND (id = t2.id))
-(5 rows)
-
index 7457194..185e000 100644 (file)
@@ -1376,18 +1376,11 @@ set_join_config_options(unsigned char enforce_mask, GucContext context)
  */
 
 static void
-ProcessUtility_hook_error_callback(void *arg)
-{
-       stmt_name = NULL;
-}
-
-static void
 pg_hint_plan_ProcessUtility(Node *parsetree, const char *queryString,
                                                        ParamListInfo params, bool isTopLevel,
                                                        DestReceiver *dest, char *completionTag)
 {
        Node                               *node;
-       ErrorContextCallback    errcontext;
 
        if (!pg_hint_plan_enable)
        {
@@ -1427,12 +1420,6 @@ pg_hint_plan_ProcessUtility(Node *parsetree, const char *queryString,
        {
                ExecuteStmt        *stmt;
 
-               /* Set up callback to statement name reset. */
-               errcontext.callback = ProcessUtility_hook_error_callback;
-               errcontext.arg = NULL;
-               errcontext.previous = error_context_stack;
-               error_context_stack = &errcontext;
-
                stmt = (ExecuteStmt *) node;
                stmt_name = stmt->name;
        }
@@ -1447,9 +1434,6 @@ pg_hint_plan_ProcessUtility(Node *parsetree, const char *queryString,
        if (stmt_name)
        {
                stmt_name = NULL;
-
-               /* Remove error callback. */
-               error_context_stack = errcontext.previous;
        }
 }
 
index e10d776..26d69a3 100644 (file)
@@ -127,5 +127,3 @@ EXPLAIN (COSTS false) EXECUTE p7 (10);
 -- error case
 /*+ NestLoop(t1 t2) */
 EXPLAIN (COSTS false) EXECUTE p8 (10);
-/*+ NestLoop(t1 t2) */
-EXPLAIN (COSTS false) SELECT count(*) FROM t1, t2 WHERE t1.id = t2.id AND t1.id > 10;