It looks like updating or deleting a records with a UUID primary key in PostgreSQL fails as it doesn't find the record. It gives "Project UUIDTest.exe raised exception class EZDatabaseError with message '0 record(s) updated. Only one record should have been updated" Demo with delete application attached although update will cause the same issue.
It looks like uuid fields will be retrieved correctly, but get messed up when inserted. Here's a simple test case of inserting a guid and then selecting it back. The results are:
Inserted: {783DAE87-E33E-4314-8730-398ED525F07B}
Retrieved: {87AE3D78-3EE3-1443-8730-398ED525F07B}
Note: In ZDbcPostgreSqlResultSet the getGuid function seems to indicate that Pg's internal uuid structure is different than the standard. Maybe that conversion has to happen when sending a uuid to pg as well? That's purely a guess btw!
Hello Mark,
when comparing your UUIDs, it seems that bytes get swapped somewhere - or need to be swapped again somewhere. Looking at the structure of a TGUID might help:
So it looks like Data1, Data2 and Data3 get (not) byteswapped (little endian to big endian or vice versa), while Data4 doesn't get swapped because it is just a sequence of bytes.
So - if you create a TGUID with a value of "783DAE87-E33E-4314-8730-398ED525F07B", what does PGAdmin show?
What I also wonder about: We have tests for GUID support in the test suite. I wonder why the don't get fired with this bug? Hmmmm.....
Best regards,
Jan
I agree. As mentioned above the getGuid function does:
I'd bet that a converse setGuid is needed.
I got a chance to play around with this and overriding setguid and making that conversion appears to solve all of my issues mentioned above. Here's what I used:
-Mark
Hello Mark,
I applied your changes to the 8.0-patches branch.
Thank you :)
Best regards,
Jan
Fixed :)