Web 应用程序无法看到新的 postgresql 模式中的表
我将 postgresql (8.2) 数据库中的一些表移至新架构。 起初,我的“用户”看不到新模式中的表,但我使用 set search_path 告诉它在这个新模式中查找,
我使用使用 hibernate 的简单 Web 应用程序访问这些表。起初,即使我设置了 search_path,我的 Web 应用程序(使用“user”用户)也看不到这些表。我最终在休眠配置文件中设置了默认架构并且它起作用了,但是从我所读到的内容中我了解到我不必设置此属性?我在此应用程序中有一些 JDBC 查询,但仍然看不到新架构中的表。
我浏览了 postgresql 文档,但找不到问题的原因。我缺少什么简单的东西吗?
I moved some tables in my postgresql (8.2) database to a new schema.
at first, my "user" could not see the tables in the new schema, but I used set search_path to tell it to look in this new schema
I access these tables with a simple web application that uses hibernate. At first, my web application, which uses the "user" user, could not see the tables either, even after I set the search_path. I eventually set the default-schema in the hibernate config file and it worked, but I understand from what I've read that I should not have to set this property? I have a few JDBC queries in this app that still can't see the tables in the new schema.
I've browsed through the postgresql docs and can't find the cause of my problems. Is there something simple I'm missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SET search_path
未保留。仅对当前会话有效。您需要使用
ALTER USER
来永久进行更改,但不需要特殊权限来更改您登录的用户(即“您自己”)SET search_path
is not persisted. It is only valid for the current session.You need to use
ALTER USER
to make that change permanently, but you don't need special privileges to change the user you are logged in with (i.e. "yourself")