8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.155 2000/05/21 02:23:30 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.155.2.1 2000/08/30 21:19:32 tgl Exp $
12
12
*
13
13
* NOTES
14
14
* this is the "main" module of the postgres backend and
@@ -1452,14 +1452,14 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
1452
1452
if (!IsUnderPostmaster )
1453
1453
{
1454
1454
puts ("\nPOSTGRES backend interactive interface " );
1455
- puts ("$Revision: 1.155 $ $Date: 2000/05/21 02:23:30 $\n" );
1455
+ puts ("$Revision: 1.155.2.1 $ $Date: 2000/08/30 21:19:32 $\n" );
1456
1456
}
1457
1457
1458
1458
/*
1459
1459
* Initialize the deferred trigger manager
1460
1460
*/
1461
1461
if (DeferredTriggerInit ()!= 0 )
1462
- proc_exit ( 0 ) ;
1462
+ goto normalexit ;
1463
1463
1464
1464
SetProcessingMode (NormalProcessing );
1465
1465
@@ -1479,12 +1479,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
1479
1479
TPRINTF (TRACE_VERBOSE ,"AbortCurrentTransaction" );
1480
1480
1481
1481
AbortCurrentTransaction ();
1482
- InError = false;
1482
+
1483
1483
if (ExitAfterAbort )
1484
- {
1485
- ProcReleaseLocks ();/* Just to be sure... */
1486
- proc_exit (0 );
1487
- }
1484
+ gotoerrorexit ;
1485
+
1486
+ InError = false;
1488
1487
}
1489
1488
1490
1489
Warn_restart_ready = true;/* we can now handle elog(ERROR) */
@@ -1553,8 +1552,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
1553
1552
if (HandleFunctionRequest ()== EOF )
1554
1553
{
1555
1554
/* lost frontend connection during F message input */
1556
- pq_close ();
1557
- proc_exit (0 );
1555
+ gotonormalexit ;
1558
1556
}
1559
1557
break ;
1560
1558
@@ -1608,11 +1606,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
1608
1606
*/
1609
1607
case 'X' :
1610
1608
case EOF :
1611
- if (!IsUnderPostmaster )
1612
- ShutdownXLOG ();
1613
- pq_close ();
1614
- proc_exit (0 );
1615
- break ;
1609
+ gotonormalexit ;
1616
1610
1617
1611
default :
1618
1612
elog (ERROR ,"unknown frontend message was received" );
@@ -1642,10 +1636,20 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
1642
1636
if (IsUnderPostmaster )
1643
1637
NullCommand (Remote );
1644
1638
}
1645
- }/* infinite for-loop */
1639
+ }/* end of main loop */
1640
+
1641
+ normalexit :
1642
+ ExitAfterAbort = true;/* ensure we will exit if elog during abort */
1643
+ AbortOutOfAnyTransaction ();
1644
+ if (!IsUnderPostmaster )
1645
+ ShutdownXLOG ();
1646
+
1647
+ errorexit :
1648
+ pq_close ();
1649
+ ProcReleaseLocks ();/* Just to be sure... */
1650
+ proc_exit (0 );
1646
1651
1647
- proc_exit (0 );/* shouldn't get here... */
1648
- return 1 ;
1652
+ return 1 ;/* keep compiler quiet */
1649
1653
}
1650
1654
1651
1655
#ifndef HAVE_GETRUSAGE