@@ -119,6 +119,7 @@ initialize_worker_spi(worktable *table)
119
119
appendStringInfo (& buf , "select count(*) from pg_namespace where nspname = '%s'" ,
120
120
table -> schema );
121
121
122
+ debug_query_string = buf .data ;
122
123
ret = SPI_execute (buf .data , true, 0 );
123
124
if (ret != SPI_OK_SELECT )
124
125
elog (FATAL , "SPI_execute failed: error code %d" , ret );
@@ -134,6 +135,7 @@ initialize_worker_spi(worktable *table)
134
135
135
136
if (ntup == 0 )
136
137
{
138
+ debug_query_string = NULL ;
137
139
resetStringInfo (& buf );
138
140
appendStringInfo (& buf ,
139
141
"CREATE SCHEMA \"%s\" "
@@ -147,15 +149,19 @@ initialize_worker_spi(worktable *table)
147
149
/* set statement start time */
148
150
SetCurrentStatementStartTimestamp ();
149
151
152
+ debug_query_string = buf .data ;
150
153
ret = SPI_execute (buf .data , false, 0 );
151
154
152
155
if (ret != SPI_OK_UTILITY )
153
156
elog (FATAL , "failed to create my schema" );
157
+
158
+ debug_query_string = NULL ; /* rest is not statement-specific */
154
159
}
155
160
156
161
SPI_finish ();
157
162
PopActiveSnapshot ();
158
163
CommitTransactionCommand ();
164
+ debug_query_string = NULL ;
159
165
pgstat_report_activity (STATE_IDLE , NULL );
160
166
}
161
167
@@ -262,6 +268,7 @@ worker_spi_main(Datum main_arg)
262
268
StartTransactionCommand ();
263
269
SPI_connect ();
264
270
PushActiveSnapshot (GetTransactionSnapshot ());
271
+ debug_query_string = buf .data ;
265
272
pgstat_report_activity (STATE_RUNNING , buf .data );
266
273
267
274
/* We can now execute queries via SPI */
@@ -291,6 +298,7 @@ worker_spi_main(Datum main_arg)
291
298
SPI_finish ();
292
299
PopActiveSnapshot ();
293
300
CommitTransactionCommand ();
301
+ debug_query_string = NULL ;
294
302
pgstat_report_stat (false);
295
303
pgstat_report_activity (STATE_IDLE , NULL );
296
304
}
0 commit comments