*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.173 2000/08/29 09:36:47 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.174 2000/08/30 20:30:06 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.173 $ $Date: 2000/08/29 09:36:47 $\n");
+ puts("$Revision: 1.174 $ $Date: 2000/08/30 20:30:06 $\n");
}
/*
* Initialize the deferred trigger manager
*/
if (DeferredTriggerInit() != 0)
- proc_exit(0);
+ goto normalexit;
SetProcessingMode(NormalProcessing);
AbortCurrentTransaction();
if (ExitAfterAbort)
- {
- ProcReleaseLocks(); /* Just to be sure... */
- proc_exit(0);
- }
+ goto errorexit;
+
/*
* If we recovered successfully, return to normal top-level context
* and clear ErrorContext for next time.
if (HandleFunctionRequest() == EOF)
{
/* lost frontend connection during F message input */
- pq_close();
- proc_exit(0);
+ goto normalexit;
}
break;
*/
case 'X':
case EOF:
- if (!IsUnderPostmaster)
- ShutdownXLOG();
- pq_close();
- proc_exit(0);
- break;
+ goto normalexit;
default:
elog(ERROR, "unknown frontend message was received");
*/
MemoryContextCheck(TopMemoryContext);
#endif
- } /* infinite for-loop */
+ } /* end of main loop */
+
+normalexit:
+ ExitAfterAbort = true; /* ensure we will exit if elog during abort */
+ AbortOutOfAnyTransaction();
+ if (!IsUnderPostmaster)
+ ShutdownXLOG();
+
+errorexit:
+ pq_close();
+ ProcReleaseLocks(); /* Just to be sure... */
+ proc_exit(0);
- proc_exit(0); /* shouldn't get here... */
- return 1;
+ return 1; /* keep compiler quiet */
}
#ifndef HAVE_GETRUSAGE