dimitri / pgloader

Migrate to PostgreSQL in a single command!

Home Page:http://pgloader.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backslashes in Enum Values not possible.

theTigerDuck opened this issue · comments

I have a Database of a SilverStripe Project that puts Fulle qualified Classnames in an enum.

First a changed pgsql-ddl.lisp and added in line 171: (setf default (cl-ppcre:regex-replace-all "\\" default "\\\\")).
The Result is that it can create the Table but I still got an Error with the Values.

Secound approach I put in transforms.lisp:
(defun fix-enum-backslashes (string)
"Transform \ to \"
(when string
(if (search "\\" string)
string
(setf string (cl-ppcre:regex-replace-all "\" string "\\\\"))))
string)

And then in my-cast-rules.lisp
(:source (:type "enum")
:target (:type ,#'enum-or-set-name)
:using pgloader.transforms::fix-enum-backslashes)

This was teoretically working. But all my tablenames and columnes are lowercase. So I have to use --with "quote identifiers". Now all my Enum Values have double backslashes like SilverStripe\ErrorPage\ErrorPage. So I redone all my changes because it seems with "quote identifiers" they are not neccesary anymore. Now I get the same Error form the biginning. Cant even create the Table.
ERROR Database error 22P02: invalid input value for enum "ChangeSet_ClassName": "SilverStripe\Versioned\ChangeSet"

Im not a lisp programmer. I have no idea what I'm doing.

PS: How the f*ck do I end that debuger? Only solution is kill -9 in another terminal.