elog and MemoryContextSwitchTo

From: Gaetano Mendola <mendola(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: elog and MemoryContextSwitchTo
Date: 2012-02-17 22:45:02
Message-ID: jhml9d$1m3p$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-02-17 23:06:19 Re: Notes about fixing regexes and UTF-8 (yet again)
Previous Message Jaime Casanova 2012-02-17 22:42:36 Re: Triggers with DO functionality