@@ -83,7 +83,9 @@ pg_store_query_plan(PG_FUNCTION_ARGS)
83
83
fwrite (& string_len ,sizeof (size_t ),1 ,fout );
84
84
fwrite (query_string ,sizeof (char ),string_len ,fout );
85
85
86
+ set_portable_output (true);
86
87
plan_string = nodeToString (queryDesc -> plannedstmt );
88
+ set_portable_output (false);
87
89
string_len = strlen (plan_string );
88
90
fwrite (& string_len ,sizeof (size_t ),1 ,fout );
89
91
fwrite (plan_string ,sizeof (char ),string_len ,fout );
@@ -135,7 +137,19 @@ pg_exec_query_plan(PG_FUNCTION_ARGS)
135
137
int eflags = 0 ;
136
138
137
139
LoadPlanFromFile (filename ,& query_string ,& plan_string );
138
- pstmt = (PlannedStmt * )stringToNode (plan_string );
140
+
141
+ PG_TRY ();
142
+ {
143
+ set_portable_input (true);
144
+ pstmt = (PlannedStmt * )stringToNode (plan_string );
145
+ set_portable_input (false);
146
+ }
147
+ PG_CATCH ();
148
+ {
149
+ elog (INFO ,"!!!BAD PLAN: %s" ,plan_string );
150
+ PG_RE_THROW ();
151
+ }
152
+ PG_END_TRY ();
139
153
140
154
psrc = CreateCachedPlan (NULL ,query_string ,query_string );
141
155
CompleteCachedPlan (psrc ,NIL ,NULL ,NULL ,0 ,NULL ,NULL ,