I have the following simplified table in Postgres:
- User Model
- id (UUID)
- uid (varchar)
- name (varchar)
I would like a query that can find the user on either its UUID id or its text uid.
SELECT * FROM user
WHERE id = 'jsdfhiureeirh' or uid = 'jsdfhiureeirh';
My query generates an invalid input syntax for uuid since I'm obviously not using a UUID in this instance.
How do I polish this query or check if the value is a valid UUID?