Handle PostgreSQL notifications early, fix #311.

In some cases, like when client_min_messages is set to debug5,
PostgreSQL might send notification messages to the connecting client
even while opening a connection. Those are still considered WARNINGs by
the Postmodern driver...

Handle those warnings by just printing them out in the pgloader logs,
rather than considering those conditions as hard failures (signaling a
db-connection-error).
This commit is contained in:
Dimitri Fontaine 2015-11-24 10:52:25 +01:00
parent 93b6be43d4
commit 533a49a261

View File

@ -140,7 +140,14 @@
(let ((conn (gensym "conn")))
`(let* ((,conn ,connection)
(,var (handler-case
(open-connection ,conn)
;; in some cases (client_min_messages set to debug5
;; for example), PostgreSQL might send us some
;; WARNINGs already when opening a new connection
(handler-bind ((cl-postgres:postgresql-warning
#'(lambda (w)
(log-message :warning "~a" w)
(muffle-warning))))
(open-connection ,conn))
(condition (e)
(cond ((typep ,connection 'fd-connection)
(error 'fd-connection-error