How to use a state variable in a LIKE postgres query

Hi there, I have written the following query

select * from "Pets"
where "Id" like '%{{ petId.value }}%'
and "OwnerId" like '%{{ ownerId.value }}%'

Both petId and ownerId are temporary state variables. The default values for these state variables are just empty strings ("").

When I try to run the query, it gives me the following error.

* error:true
* message:"could not determine data type of parameter $1"
* source:"resource"

Is there something I need to do when trying to use the like query? I feel like theres something about the % character that is throwing the error?

Hey @Tamate and welcome to the forums! Yea, it’s mostly likely related to your syntax. Can you try {{ '%' + petId.value + '%' }}? And same with the second one.

Ahhh thats solved my issue, thank you so much!