The current noticeReceiver and noticeProcessor use lua functions that may fail and longjmp out.
One option is to lua_pcall out to a second function.
- This could make it easier to add coroutine support (via
lua_pcallk)
Alternatively, only use functions that can't fail.
- use a unique pointer and
lua_rawgetp instead of lua_pushstring+lua_rawget
- preallocate the
PGresult *
- never call
luaL_error
- A
PQnoticeReceiver is by definition called for warnings or below, so it's not supposed to fail
The current noticeReceiver and noticeProcessor use lua functions that may fail and
longjmpout.One option is to
lua_pcallout to a second function.lua_pcallk)Alternatively, only use functions that can't fail.
lua_rawgetpinstead oflua_pushstring+lua_rawgetPGresult *luaL_errorPQnoticeReceiveris by definition called for warnings or below, so it's not supposed to fail