racket / db

Other
21 stars 17 forks source link

added uuid<->string logic #6

Closed jshelley-xx closed 7 years ago

jshelley-xx commented 7 years ago

This should get v4 uuids working with postgres. Values have the feel of strings to client code.

jkominek commented 7 years ago

looks like you left some debugging println's in send-uuid

lexi-lambda commented 7 years ago

This should probably be mentioned in the documentation, in the PostgreSQL Types section. It might be worth mentioning there that UUIDs are only supported with the uuid-ossp extension enabled, but that shouldn’t really matter much, given that a uuid column could only exist with that already enabled.

jkominek commented 7 years ago

a fresh install of postgresql on freebsd, without uuid-ossp listed in pg_extension can handle uuid values fine, which seems to be consistent with the final paragraph of https://www.postgresql.org/docs/9.6/static/datatype-uuid.html

lexi-lambda commented 7 years ago

Ah, you’re right—you only need uuid-ossp to generate UUIDs. The support should still be mentioned in the documentation, though.

jshelley-xx commented 7 years ago

Looking over the type support documentation, it's talking about how arrays are also supported for each of the supported single types. I'll work on getting that running and get back to you.

jshelley-xx commented 7 years ago

uuid[] added, now, and I added the "uuid" entry to the type support doc. Hopefully that's what you were wanting.

lexi-lambda commented 7 years ago

It seems like it would also be a good idea to add a test to db-test/tests/db/db/sql-types.rkt. Otherwise, I think this change looks good, though I believe @rmculpepper is the maintainer, so his review is the important one.

jshelley-xx commented 7 years ago

Working on getting the tests (running and) updated.

jshelley-xx commented 7 years ago

Added a test case for uuids in PG.

jshelley-xx commented 7 years ago

Changed to use the file/sha1 functions and added a uuid? predicate.

lexi-lambda commented 7 years ago

I’ve taken advantage of the fact that GitHub allows maintainers to push to PR branches to implement @rmculpepper’s suggestions and document the uuid? function, mostly because I’d actually really like to have access to these changes, myself! Hopefully this should be sufficient.