OSDN Git Service

fix bug operation test No.9
authorMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Mon, 24 Sep 2012 02:22:06 +0000 (11:22 +0900)
committerMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Mon, 24 Sep 2012 02:22:06 +0000 (11:22 +0900)
PG_CATCH()を抜ける直前のErrorContextにスイッチする処理を削除した。
※PG_RE_THROW()しない場合は、ErrorContextに戻さなくても良い。

expected/pg_hint_plan.out
pg_hint_plan.c
sql/pg_hint_plan.sql

index 9030368..26963b8 100644 (file)
@@ -5196,3 +5196,24 @@ NOTICE:  identifier "12345678901234567890123456789012345678901234567890123456789
 ERROR:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
 SET cursor_tuple_fraction TO 1234567890123456789012345678901234567890123456789012345678901234;
 ERROR:  1.23457e+63 is outside the valid range for parameter "cursor_tuple_fraction" (0 .. 1)
+-- multi error
+/*+ Set(enable_seqscan 100)Set(seq_page_cost on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
+INFO:  parameter "enable_seqscan" requires a Boolean value
+INFO:  parameter "seq_page_cost" requires a numeric value
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+Set(enable_seqscan 100)
+Set(seq_page_cost on)
+
+              QUERY PLAN              
+--------------------------------------
+ Merge Join
+   Merge Cond: (t1.id = t2.id)
+   ->  Index Scan using t1_pkey on t1
+   ->  Index Scan using t2_pkey on t2
+(4 rows)
+
index 8126141..8cdd7a1 100644 (file)
@@ -1287,18 +1287,17 @@ set_config_option_wrapper(const char *name, const char *value,
        PG_CATCH();
        {
                ErrorData          *errdata;
-               MemoryContext   ecxt;
 
-               ecxt = MemoryContextSwitchTo(ccxt);
+               /* Save error info */
+               MemoryContextSwitchTo(ccxt);
                errdata = CopyErrorData();
                FlushErrorState();
+
                ereport(elevel, (errcode(errdata->sqlerrcode),
                                errmsg("%s", errdata->message),
                                errdata->detail ? errdetail("%s", errdata->detail) : 0,
                                errdata->hint ? errhint("%s", errdata->hint) : 0));
                FreeErrorData(errdata);
-
-               MemoryContextSwitchTo(ecxt);
        }
        PG_END_TRY();
 
index a652a9d..68cb68e 100644 (file)
@@ -588,3 +588,7 @@ EXPLAIN (COSTS false) SELECT * FROM t1 "1234567890123456789012345678901234567890
 SET "123456789012345678901234567890123456789012345678901234567890123" TO 1;
 SET "1234567890123456789012345678901234567890123456789012345678901234" TO 1;
 SET cursor_tuple_fraction TO 1234567890123456789012345678901234567890123456789012345678901234;
+
+-- multi error
+/*+ Set(enable_seqscan 100)Set(seq_page_cost on)*/
+EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;