Fix custom CAST rules with expressions, fix #322.

In a previous commit the typemod matching code had been broken, and we
failed to notice that until now. Thanks to bug report #322 we just got
the memo...

Add a test case in the local-only MySQL database.

The regression testing facilities should be improved to be able to test
a full database, and then to dynamically create said database from code
or something to ease test coverage of those cases.
This commit is contained in:
Dimitri Fontaine 2016-01-12 14:55:17 +01:00
parent 2c200f5747
commit 44a2bd14d4
2 changed files with 4 additions and 3 deletions

View File

@ -27,7 +27,7 @@
(mapcar #'parse-integer
(sq:split-sequence #\, column-type
:start (+ 1 start-1) :end end))
(cons a b))))))
(list a b))))))
(defun typemod-expr-matches-p (rule-typemod-expr typemod)
"Check if an expression such as (< 10) matches given typemod."
@ -98,7 +98,7 @@
(t type)))
(pg-typemod
(when source-typemod
(destructuring-bind (a . b) source-typemod
(destructuring-bind (a &optional b) source-typemod
(format nil "(~a~:[~*~;,~a~])" a b b)))))
(make-column :name (apply-identifier-case source-column-name)
:type-name type-name

View File

@ -26,8 +26,9 @@ LOAD DATABASE
column ascii.s using byte-vector-to-bytea,
column enumerate.foo using empty-string-to-null,
column ip.ip_address to inet keep not null drop typemod
column ip.ip_address to inet keep not null drop typemod,
type decimal when (= precision 1) to boolean drop typemod
MATERIALIZE VIEWS nonexisting,
d as $$