hugsql

bostonaholic 2017-05-03T20:59:51.519045Z

I’m getting a org.postgresql.util.PSQLException: ERROR: operator does not exist: enum_social_network = character varying when I try to query with an enum like so

SELECT * from accounts where social_network = :social-network::enum_social_network;

bostonaholic 2017-05-03T21:00:02.521940Z

how can I do that?

bostonaholic 2017-05-03T21:00:59.537151Z

here’s my enum definition create type enum_social_network as enum ('facebook', 'twitter', 'instagram');

bostonaholic 2017-05-03T21:06:51.623938Z

If I just run SELECT * from accounts where social_network = 'twitter'::enum_social_network; directly into a SQL console, it works as expected

bostonaholic 2017-05-03T21:18:24.782172Z

SELECT * from accounts where social_network::text = :social-network; seems to work

bostonaholic 2017-05-03T21:18:31.783701Z

casting the otherside…