elog and MemoryContextSwitchTo - Mailing list pgsql-hackers

From Gaetano Mendola
Subject elog and MemoryContextSwitchTo
Date
Msg-id jhml9d$1m3p$1@news.hub.org
Whole thread Raw
Responses Re: elog and MemoryContextSwitchTo  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi all,

Is the following code well formed?

oldContext = MemoryContextSwitchTo(newContext);
....
if (something_bad) {  elog(ERROR, ...);
}
...
MemoryContextSwitchTo(oldContext);


or do I have to ripristinate the oldContext before to issue the elog ?



Regards
Gaetano Mendola



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Notes about fixing regexes and UTF-8 (yet again)
Next
From: Tom Lane
Date:
Subject: Re: elog and MemoryContextSwitchTo