-
Notifications
You must be signed in to change notification settings - Fork 51
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
Support and default to UUID for PostgreSQL uuid #262
base: master
Are you sure you want to change the base?
Conversation
@testset "UUID" begin | ||
tests = ( | ||
("'6dc2b682-a411-a51f-ce9e-af63d1ef7c1a'::uuid", UUID("6dc2b682-a411-a51f-ce9e-af63d1ef7c1a")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
@testset "UUID" begin | |
tests = ( | |
("'6dc2b682-a411-a51f-ce9e-af63d1ef7c1a'::uuid", UUID("6dc2b682-a411-a51f-ce9e-af63d1ef7c1a")), | |
@testset "Parameters" begin | |
conn = LibPQ.Connection( | |
"dbname=postgres user=$DATABASE_USER"; throw_error=true |
@testset for (pg_str, obj) in tests | ||
result = execute(conn, "SELECT $pg_str = \$1", [obj]) | ||
@test first(first(result)) | ||
close(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
@testset for (pg_str, obj) in tests | |
result = execute(conn, "SELECT $pg_str = \$1", [obj]) | |
@test first(first(result)) | |
close(result) | |
@testset "UUID" begin | |
tests = (( | |
"'6dc2b682-a411-a51f-ce9e-af63d1ef7c1a'::uuid", | |
UUID("6dc2b682-a411-a51f-ce9e-af63d1ef7c1a"), | |
),) | |
@testset for (pg_str, obj) in tests | |
result = execute(conn, "SELECT $pg_str = \$1", [obj]) | |
@test first(first(result)) | |
close(result) | |
end |
@test first(first(result)) | ||
close(result) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
end |
Seems to work well. Can it be merged? |
LGTM, reminder to bump the minor release. I'm inclined to holdoff on changing the String fallback for now. Might want to make an issue for it though? |
Good to merge? |
No, this MR needs a rebase before we can proceed. |
Rebased: |
Closes #260
This adds binary format parsing for UUID and sets the default Julia type for PostgreSQL's
uuid
toBase.UUID
. The import relies on the UUIDs stdlib export for stability's sake.Array support was easy enough to add as well.
Open question on whether changing the default type away from the
String
fallback needs a major version update: https://discourse.julialang.org/t/anyone-fetching-uuids-using-libpq-jl/89395/3I think if people conclude it does, I'll change to ensure this doesn't set the default but still supports the same operations when UUID is specified.