Hello, postgresmen!
š
I found incorrect execution of ereport() macro.
If we pass into ereport() function 2 or more arguments, the macro errcontext does not correct execute. So, ereport() call stack is:
š
errstart
errcontext_msg
set_errcontext_domain
errmsg
errfinish
pg_unreachable
š
This bug causes that error messages (for example, in PL/TCL) are not localized.

Solutions:
- Wrap all errcontext() macro in
brackets, that is errcontext("error message %s", "end message") -> (errcontext("error message %s", "end message"))
- Rewrite this macro
- ???
š
I am attaching to this letter a test case that shows the behavior errcontext() macro and the way to fix it.

I am using postgresql 9.4 and test it on gcc 4.7 and gcc 4.8.1.

-- Best regards, Dmitry Voronin