adelsz / pgtyped

pgTyped - Typesafe SQL in TypeScript
https://pgtyped.dev
MIT License
2.92k stars 95 forks source link

How can I interpolate a variable into a string? #499

Closed jakewhelan closed 1 year ago

jakewhelan commented 1 year ago

I'm trying to do this:

SELECT * FROM foo
WHERE bar LIKE '%$bar%'

Is this supported?

The query doesn't work basically, it matches nothing - so I am assuming $bar isn't being interpolated into that string.

jakewhelan commented 1 year ago

I was able to achieve the same thing like this:

SELECT * FROM foo
WHERE position($bar in bar) > 0