Skip to content
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

Cannot look up by UUID #142

Closed
himat opened this issue Aug 18, 2022 · 2 comments
Closed

Cannot look up by UUID #142

himat opened this issue Aug 18, 2022 · 2 comments

Comments

@himat
Copy link

himat commented Aug 18, 2022

Hi, I have a table with a UUID column (called external_id) and I'm trying to write a query to look up a row by UUID but it's not working and fails with

clojure.lang.ExceptionInfo: ERROR: operator does not exist: uuid = character varying
  Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
  Position: 42 {:query-id :get-business-for-external-id}
        at conman.core$try_query$fn__15886$fn__15887.invoke(core.clj:34)

Here's the hugsql function

-- :name get-business-for-external-id :? :1
-- :doc retrieves a record given the external id
SELECT * FROM business
WHERE external_id = :external_id

I even tried doing WHERE external_id = :external_id::uuid but that didn't work either

@csummers
Copy link
Member

WHERE external_id = :external_id::uuid is the solution to this issue. Are you sure this didn't work?

@himat
Copy link
Author

himat commented Aug 19, 2022

It worked now actually. I think I maybe just confused myself with another error that happened after I did the fix.

@himat himat closed this as completed Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants