New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSSQL Server UniqueIdentifier #910
Comments
Hi @hyppopotamus ; can you give more information about the issue you have? Such as for example a list of identifiers in SQL Server and their migrated version in PostgreSQL? |
Hi @dimitri , sure MSSQL
Postgres
|
That's quite strange indeed. The whole code that handles the transformation of the unique identifiers to UUID is pasted below. We receive the UUID as a vector of bytes and use a standard UUID library to transform the bytes into a string representation. This library doesn't seem to know about the way MS does its GUID, I'm going to try something: (defun sql-server-uniqueidentifier-to-uuid (id)
(declare (type (or null (array (unsigned-byte 8) (16))) id))
(when id
(format nil "~a" (uuid:byte-array-to-uuid id)))) |
Please compile from sources and try again, it might work better now with the adjusted transformation function. As I've coded that mostly “blind” (I tested with a single value from the stack overflow page you've quoted), more testing is necessary on this one. CL-USER> (pgloader.transforms::sql-server-uniqueidentifier-to-uuid
(uuid:uuid-to-byte-array
(uuid:make-uuid-from-string
"EBA4DE58-D35F-46D9-9049-7939381F1A3B")))
"58DEA4EB-5FD3-D946-9049-7939381F1A3B" |
Please fix, or compilation error happens =) hyppo@d9:~/GITS/pgloader$ git diff
diff --git a/src/utils/transforms.lisp b/src/utils/transforms.lisp
index 750add8..0c6961d 100644
--- a/src/utils/transforms.lisp
+++ b/src/utils/transforms.lisp
@@ -383,7 +383,7 @@
:clock-seq-var (aref id 8)
:clock-seq-low (aref id 9)
:node (uuid::arr-to-bytes 10 15 id))))
- (princ-to-string uuid)))))
+ (princ-to-string uuid))))
(defun unix-timestamp-to-timestamptz (unixtime-string)
"Takes a unix timestamp (seconds since beginning of 1970) and converts it |
When using interactive recompiling of the code in Emacs/SLIME, extra closing parens are just ignored in Emacs before sending the current form to the CL compiler. When compiling from the source files, of course, that doesn't work. See #910.
Oops. Sorry about that. Emacs/SLIME interactive environment is good at ignoring that problem, compiling from files is not, and I didn't recompile the whole project before sending the previous fix... |
looks good, |
pgloader --version
pgloader version "3.6.1"
compiled with SBCL 1.4.0-1.el7
config
The first half of the uuid translated "backward" for each section.
Additionals:
https://dba.stackexchange.com/questions/121869/sql-server-uniqueidentifier-guid-internal-representation
https://stackoverflow.com/questions/17679/why-does-guid-tostring-reverse-the-byte-order
The text was updated successfully, but these errors were encountered: