@@ -501,22 +501,18 @@ begin_remote_xact(ConnCacheEntry *entry)
501
501
{
502
502
int curlevel = GetCurrentTransactionNestLevel ();
503
503
PGresult * res ;
504
+ char sql [128 ];
504
505
505
506
506
507
/* Start main transaction if we haven't yet */
507
508
if (entry -> xact_depth <= 0 )
508
509
{
509
- const char * sql ;
510
-
511
510
elog (DEBUG3 , "starting remote transaction on connection %p" ,
512
511
entry -> conn );
513
512
514
- if (IsolationIsSerializable ())
515
- sql = "START TRANSACTION ISOLATION LEVEL SERIALIZABLE" ;
516
- else if (UseRepeatableRead )
517
- sql = "START TRANSACTION ISOLATION LEVEL REPEATABLE READ" ;
518
- else
519
- sql = "START TRANSACTION" ;
513
+ sprintf (sql , "START TRANSACTION %s; set application_name='pgfdw:%lld:%d';" ,
514
+ IsolationIsSerializable () ? "ISOLATION LEVEL SERIALIZABLE" : UseRepeatableRead ? "ISOLATION LEVEL REPEATABLE READ" : "" ,
515
+ (long long )GetSystemIdentifier (), MyProcPid );
520
516
entry -> changing_xact_state = true;
521
517
do_sql_command (entry -> conn , sql );
522
518
entry -> xact_depth = 1 ;
@@ -568,8 +564,6 @@ begin_remote_xact(ConnCacheEntry *entry)
568
564
*/
569
565
while (entry -> xact_depth < curlevel )
570
566
{
571
- char sql [64 ];
572
-
573
567
snprintf (sql , sizeof (sql ), "SAVEPOINT s%d" , entry -> xact_depth + 1 );
574
568
entry -> changing_xact_state = true;
575
569
do_sql_command (entry -> conn , sql );
0 commit comments