diff --git a/src/pgsql/pgsql-ddl.lisp b/src/pgsql/pgsql-ddl.lisp index 3b3e59e..81323f1 100644 --- a/src/pgsql/pgsql-ddl.lisp +++ b/src/pgsql/pgsql-ddl.lisp @@ -26,7 +26,9 @@ ((:enum :set) (format stream "CREATE TYPE ~a AS ENUM (~{'~a'~^, ~});" (sqltype-name sqltype) - (sqltype-extra sqltype))))) + (mapcar (lambda (value) + (cl-ppcre:regex-replace-all "'" value "''")) + (sqltype-extra sqltype)))))) (defmethod format-drop-sql ((sqltype sqltype) &key (stream nil) cascade if-exists) (format stream "DROP TYPE~:[~; IF EXISTS~] ~a~@[ CASCADE~];" diff --git a/src/sources/mysql/mysql-cast-rules.lisp b/src/sources/mysql/mysql-cast-rules.lisp index a2ec843..c9766c6 100644 --- a/src/sources/mysql/mysql-cast-rules.lisp +++ b/src/sources/mysql/mysql-cast-rules.lisp @@ -157,7 +157,7 @@ "Convert MySQL ENUM expression into a list of labels." (cl-ppcre:register-groups-bind (list) ("(?i)(?:ENUM|SET)\\s*\\((.*)\\)" ctype) - (first (cl-csv:read-csv list :separator #\, :quote #\' :escape "\\")))) + (first (cl-csv:read-csv list :separator #\, :quote #\' :escape "''")))) (defmethod cast ((col mysql-column)) "Return the PostgreSQL type definition from given MySQL column definition."