Visitar URL original
UUID ToField instance doesn't work when type can't be inferred from context · Issue #277 · lpsmith/postgresql-simple · GitHub
Skip to content

UUID ToField instance doesn't work when type can't be inferred from context #277

Open

Description

@kmicklas

The following query works:

select uuid_generate_v3(t.x, 'foo') from (values ('55c163fc-8e21-4f2a-b26d-6a7fa3e5d896'::uuid)) as t(x);

but this does not:

select uuid_generate_v3(t.x, 'foo') from (values ('55c163fc-8e21-4f2a-b26d-6a7fa3e5d896')) as t(x);

The ToField instance for UUID only outputs the quoted text, so it will fail when interpolated into a query like the second one. I guess if you're using postgresql-simple directly you can just know to append ::uuid in the query text, but this is a problem for higher level query libraries like Beam which would like to reuse postgresql-simple's ToField instances and generate query strings parametrically.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions