当与PostgreSQL一起去时,光滑的问题

我在 Scala项目中使用 slick来查询某些表.
//define table
object Addresses extends Table[Address]("assetxs.address") {
  def id = column[Int]("id",O.PrimaryKey)
  def street = column[String]("street")
  def number = column[String]("number")
  def zipcode = column[String]("zipcode")
  def country = column[String]("country")
  def * = id ~ street ~ number ~ zipcode ~ country <> (Address,Address.unapply _)
}

如果我使用这个表的任何查询,它不起作用(它说它找不到我的表),所以我进一步打印出如下查询:

implicit val session = Database.forURL("jdbc:postgresql://localhost:5432/postgres",driver = "org.postgresql.Driver",user="postgres",password="postgres").createSession()
      session.withTransaction{
        val query = Query(Addresses)
        println("Addresses: " + query.selectStatement)
}

我注意到schema.table的名字出现在“”中,所以语句是:

select x2."id",x2."street",x2."number",x2."zipcode",x2."country"
from "assetxs.address" x2

这当然不起作用(我试图在PostgreSQL工具中运行它,我需要从表名中删除“”才能使其工作.

你可以告诉我,如果在使用表格名称时有任何查询中有没有包含“”的光滑选项?

最后我能够解决这个问题.

我仅指定表名:

对象地址扩展表[Address](“address”)

并且在搜索时更改我的postgresql conf以包含我的模式(似乎只是在公共模式上看):

search_path =’“$user”,assetxs,public’

现在它的工作.

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...