Re: Different gettext domain needed for error context

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Different gettext domain needed for error context
Дата
Msg-id 4F8BD4B1.5050901@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Different gettext domain needed for error context  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 15.04.2012 00:54, Tom Lane wrote:
> I really think we need to change errcontext itself to pass the correct
> domain.  If we are going to require a domain to be provided (and this
> does require that, for correct operation), then we need to break any
> code that doesn't provide it in a visible fashion.
>
> A possibly more attractive alternative is to redefine errcontext
> with a macro that allows TEXTDOMAIN to be passed in behind-the-scenes,
> thus keeping source-level compatibility.  We can do this with the same
> type of hack we've used for many years for elog():
>
> #define errcontext  set_errcontext_domain(TEXTDOMAIN), errcontext_msg
>
> where the actual message-passing function is now called errcontext_msg.

Ok then, here's a patch using that approach.

I had to rename a few local variables called "errcontext", because the
macro now tries to expands those and you get an error.

Note: If you want to test this at home, the original test case I posted
doesn't currently work because the text of the context messages in
PL/pgSQL have been slightly changed since I posted the original test
case, but the translations have not been updated yet. Until then, you
can manually remove the double quotes in messages like 'function \"%s\"'
in the .po file to test this.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Last gasp
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: index-only scans vs. Hot Standby, round two