I'm trying to cast a list of ip addresses to ::inet but only the last element in the list gets converted.
I've tried the following but nothing seems to work.
select * from ip_addresses where address in (:addresses::inet)
select * from ip_addresses where address in (:addresses)::inet
select * from ip_addresses where address in CAST (:addresses AS inet)
I can't simply cast the address::text since matches can fail if the input addresses don't have a subnet specified.
Sounds like HugSQL is replacing
:addresseswith a comma delimited list so your(:addresses::inet)ends up looking like(addr, addr, addr, ..., addr::inet). If that's the case then you could replacein (list)with= any(array), use the array constructor syntax, and apply a cast to that array as a whole: