|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.173 2000/08/29 09:36:47 petere Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.174 2000/08/30 20:30:06 tgl Exp $ |
12 | 12 | * |
13 | 13 | * NOTES |
14 | 14 | * this is the "main" module of the postgres backend and |
@@ -1404,14 +1404,14 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) |
1404 | 1404 | if (!IsUnderPostmaster) |
1405 | 1405 | { |
1406 | 1406 | puts("\nPOSTGRES backend interactive interface "); |
1407 | | -puts("$Revision: 1.173 $ $Date: 2000/08/29 09:36:47 $\n"); |
| 1407 | +puts("$Revision: 1.174 $ $Date: 2000/08/30 20:30:06 $\n"); |
1408 | 1408 | } |
1409 | 1409 |
|
1410 | 1410 | /* |
1411 | 1411 | * Initialize the deferred trigger manager |
1412 | 1412 | */ |
1413 | 1413 | if (DeferredTriggerInit()!=0) |
1414 | | -proc_exit(0); |
| 1414 | +gotonormalexit; |
1415 | 1415 |
|
1416 | 1416 | SetProcessingMode(NormalProcessing); |
1417 | 1417 |
|
@@ -1451,10 +1451,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) |
1451 | 1451 | AbortCurrentTransaction(); |
1452 | 1452 |
|
1453 | 1453 | if (ExitAfterAbort) |
1454 | | -{ |
1455 | | -ProcReleaseLocks();/* Just to be sure... */ |
1456 | | -proc_exit(0); |
1457 | | -} |
| 1454 | +gotoerrorexit; |
| 1455 | + |
1458 | 1456 | /* |
1459 | 1457 | * If we recovered successfully, return to normal top-level context |
1460 | 1458 | * and clear ErrorContext for next time. |
@@ -1547,8 +1545,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) |
1547 | 1545 | if (HandleFunctionRequest()==EOF) |
1548 | 1546 | { |
1549 | 1547 | /* lost frontend connection during F message input */ |
1550 | | -pq_close(); |
1551 | | -proc_exit(0); |
| 1548 | +gotonormalexit; |
1552 | 1549 | } |
1553 | 1550 | break; |
1554 | 1551 |
|
@@ -1607,11 +1604,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) |
1607 | 1604 | */ |
1608 | 1605 | case'X': |
1609 | 1606 | caseEOF: |
1610 | | -if (!IsUnderPostmaster) |
1611 | | -ShutdownXLOG(); |
1612 | | -pq_close(); |
1613 | | -proc_exit(0); |
1614 | | -break; |
| 1607 | +gotonormalexit; |
1615 | 1608 |
|
1616 | 1609 | default: |
1617 | 1610 | elog(ERROR,"unknown frontend message was received"); |
@@ -1649,10 +1642,20 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) |
1649 | 1642 | */ |
1650 | 1643 | MemoryContextCheck(TopMemoryContext); |
1651 | 1644 | #endif |
1652 | | -}/* infinite for-loop */ |
| 1645 | +}/* end of main loop */ |
| 1646 | + |
| 1647 | +normalexit: |
| 1648 | +ExitAfterAbort= true;/* ensure we will exit if elog during abort */ |
| 1649 | +AbortOutOfAnyTransaction(); |
| 1650 | +if (!IsUnderPostmaster) |
| 1651 | +ShutdownXLOG(); |
| 1652 | + |
| 1653 | +errorexit: |
| 1654 | +pq_close(); |
| 1655 | +ProcReleaseLocks();/* Just to be sure... */ |
| 1656 | +proc_exit(0); |
1653 | 1657 |
|
1654 | | -proc_exit(0);/* shouldn't get here... */ |
1655 | | -return1; |
| 1658 | +return1;/* keep compiler quiet */ |
1656 | 1659 | } |
1657 | 1660 |
|
1658 | 1661 | #ifndefHAVE_GETRUSAGE |
|