问题

可能吗?我可以在连接URL上指定它吗?怎么做?


#1 热门回答(128 赞)

我知道这已经得到了回答,但是我遇到了同样的问题,试图指定用于liquibase命令行的模式。

更新对于JDBC v9.4,你可以使用新的currentSchema参数指定url,如下所示:

jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema

出现基于早期补丁:
http://web.archive.org/web/20141025044151/http://postgresql.1045698.n5.nabble.com/Patch-to-allow-setting-schema-search-path-in-the-connectionURL-td2174512.html
哪个提议网址是这样的:

jdbc:postgresql://localhost:5432/mydatabase?searchpath=myschema

#2 热门回答(52 赞)

截至version 9.4,你可以在连接字符串中使用currentSchema参数。

例如:

jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema

#3 热门回答(48 赞)

如果在你的环境中可以,你还可以将用户的默认架构设置为所需的架构:

ALTER USER user_name SET search_path to 'schema'

原文链接