Hi,
Regarding the function parameter ref TODO:
I am trying to catch and copy an error to be re-thrown later.
I have the following questions:
1. Is the catch part in the following safe?
2. How do I re-throw the copied error when I am not in ErrorContext anymore?
I cannot use ReThrowError because of Assert.
3. If I have to use something like: ereport(ERROR,mysaved_error->message ...
mysaved_error->detail ...... );
then how do I FreeErrorData(mysaved_error) after calling the ereport
above?
First:
....
MemoryContext parseMemCtx = CurrentMemoryContext;
....
Then:
/* Try to identify as a once-qualified column */
PG_TRY();
{
node = qualifiedNameToVar(pstate, NULL, name1, name2, true,
cref->location);
/* status set to 0 or 1 */
qualified_status = (node != NULL);
}
PG_CATCH();
{
/* copy this error for later use */
errorMemCtx = CurrentMemoryContext;
MemoryContextSwitchTo(parseMemCtx);
qualifiedErrData = CopyErrorData();
FlushErrorState();
MemoryContextSwitchTo(errorMemCtx);
/* status is set to error */
qualified_status = 2;
}
PG_END_TRY();
------------------------------------------------
Gevik Babakhani
PostgreSQL NL http://www.postgresql.nl
TrueSoftware BV http://www.truesoftware.nl
------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings