arcapos / luapgsql

Lua binding for PostgreSQL
108 stars 24 forks source link

setNoticeReceiver + setNoticeProcessor should return the previous function #15

Closed daurnimator closed 7 years ago

daurnimator commented 9 years ago

http://www.postgresql.org/docs/current/static/libpq-notice-processing.html

Each of these functions returns the previous notice receiver or processor function pointer, and sets the new value. If you supply a null function pointer, no action is taken, but the current pointer is returned.

mbalmer commented 9 years ago

This won't work easily, since a wrapper function gets installed that calls a Lua function. I wonder if it's worth the effort to make it 100% compatible to libpq here. To you use this feature?

daurnimator commented 9 years ago

I was thinking you'd just return the previous value of (e.g.) __pgsqlNoticeReceiver As luapgsql 'owns' the PGConn object; you probably can assume that the notice receiver will always be yours...

mbalmer commented 7 years ago

I think this can well be dealt with in Lua itself.