I am trying to show all data when filter is not in use

select * from users group by id having 1=1 and (true OR id = {{ textInput1.value }}) order by id

I am getting this error for both code.
invalid input syntax for type integer: ""

I am not sure if this is a bug or if it is something wrong on my end.

Hello @William, welcome to the forums!

I believe your textInput.value is a string but your id field is an integer. You should either parse the value in between the {{ }} or CONVERT the result in the select query and see if that resolves the error.

1 Like

Hi @pyrrho , thanks!

select * from users 
group by id 
having 1=1 and ({{ !textInput1.value }} or id = {{ Number(textInput1.value) }})
order by id

I converted it and it works!
Not sure why though. I set the ID column to string so I thought it should be able to read textInput1.value as a string.

2 Likes