Handle default values particularities for IXF.

It turns out that IXF format might embed particulars of the systems the
data comes from (Informix or DB2) and we need to process some strings so
that they are compatible with PostgreSQL ("CURRENT TIMESTAMP" here).

See #272 that should be fixed here, but being in the blind, don't close
the issue just yet.
This commit is contained in:
Dimitri Fontaine 2015-09-04 12:25:11 +02:00
parent e76a4c8f5a
commit 33fc3add25

View File

@ -47,6 +47,11 @@
(error "IXF Type mapping unknown for: ~x" ixf-type))
pgtype))
(defun format-default-value (default)
"IXF has some default values that we want to transform here, statically."
(cond ((string= "CURRENT TIMESTAMP" default) "CURRENT_TIMESTAMP")
(t default)))
(defmethod format-pgsql-column ((col ixf:ixf-column))
"Return a string reprensenting the PostgreSQL column definition"
(let* ((column-name (apply-identifier-case (ixf:ixf-column-name col)))
@ -56,7 +61,7 @@
(cast-ixf-type (ixf:ixf-column-type col))
(ixf:ixf-column-nullable col)
(ixf:ixf-column-has-default col)
(ixf:ixf-column-default col))))
(format-default-value (ixf:ixf-column-default col)))))
(format nil "~a ~22t ~a" column-name type-definition)))