Raw query for RLS not working
I am trying to migrate a raw query from TypeORM's builtin query builder to Kysely.
It's required to be raw as Kysely unfortunately does not fully implement Postgres's SQL language.
Original query:
What I wrote:
Error:
Any idea?
2 Replies
sql
template string automatically generates parameter placeholders: https://kyse.link/?p=s&i=BIWYEWyxKcZCWJ0i0XBk
BUT you can't parameterize entity names in postgres.
use sql.raw
instead: https://kyse.link/?p=s&i=HD2An3oWQLWVDPYmZO4m
As you know, beware of SQL injection in this case.Thank you. Too bad.