我正在尝试让基本的普通SQL示例在Slick 3中工作,在Postgres上,但使用自定义DB模式,比如local而不是默认的public one。在执行以下代码时,我很难插入行
sqlu"INSERT INTO schedule(user_id, product_code, run_at) VALUES ($userId, $code, $nextRun)"他说
org.postgresql.util.PSQLException: ERROR: relation "schedule" does not exist这个表之所以存在,是因为当我在insert语句中使用local.作为schedule前缀时,它可以正常工作。如何才能将正确的模式提供给此查询?
我使用它作为akka-projection处理程序的一部分,所有像维护偏移量这样的投影内部机制在local模式上都能像预期的那样工作。
我不能简单地将schema作为变量,因为它在解析参数时出错:
sqlu"INSERT INTO ${schema}.schedule(user_id, product_code, run_at) VALUES ($userId, $code, $nextRun)"发布于 2021-11-04 03:25:48
可以使用#${value}插入架构名称
sqlu"INSERT INTO #${schema}.table ..."https://stackoverflow.com/questions/69814091
复制相似问题