From e2fcd8686841f9d7269d89528826aff479b40757 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 22 Mar 2016 00:27:06 +0100 Subject: [PATCH] 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. --- src/pgsql/schema.lisp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pgsql/schema.lisp b/src/pgsql/schema.lisp index 3dcd095..666cd42 100644 --- a/src/pgsql/schema.lisp +++ b/src/pgsql/schema.lisp @@ -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))))