Handle failure to convert index filters gracefully.

We should not block any processing just because we can't parse an index.
The best we can do just tonight is to try creating the index without the
filter, ideally we would have to skip building the index entirely.
That's for a later effort though, it's running late here.

See #365.
This commit is contained in:
Dimitri Fontaine 2016-03-22 00:27:06 +01:00
parent ac7f326447
commit e2fcd86868

View File

@ -364,7 +364,18 @@
(defmethod process-index-definitions ((table table) &key sql-dialect)
"Rewrite all index filter in TABLE."
(loop :for index :in (table-index-list table)
:do (let ((pg-filter (translate-index-filter table index sql-dialect)))
:do (let ((pg-filter
(handler-case
(translate-index-filter table index sql-dialect)
(condition (c)
(log-message :error
"Failed to translate index ~s on table ~s because of filter clause ~s"
(pgsql-index-name index)
(format-table-name table)
(pgsql-index-filter index))
(log-message :debug "filter translation error: ~a" c)
;; try to create the index without the WHERE clause...
(setf (pgsql-index-filter index) nil)))))
(log-message :info "tranlate-index-filter: ~s" pg-filter)
(setf (pgsql-index-filter index) pg-filter))))