在Heroku Postgres上,如何更改全文搜索字典?

发布于 2025-02-10 01:18:16 字数 736 浏览 3 评论 0原文

我想更改我的“ Hobby Basic Heroku Postgres”数据库的default_text_search_config 。运行

HEROKU PG:PSQL\ df

我可以看到Heroku有一个我想要的预设停止词典-Russian(PG_CATALOG.RUSSIAN),因此无需创建一个新的词典(尽管我也看到了许多问题)。

根据 postgres docs ,可以通过改变<<<<<<<代码> postgresql.conf ,在这种情况下不适用,也不适用于单个会话。我已经尝试使用

设置Default_text_search_config ='PG_CATALOG.URSIAN';

但是,一旦我退出CLI,它将恢复为初始pg_catalog.english.english.english >。

我正在使用Prisma,所以我也尝试应用了此迁移的迁移,认为问题是在我关闭CLI之后不会持续存在的问题。这也不成功。

有办法这样做吗?

I'm wanting to change the default_text_search_config of my "Hobby Basic Heroku Postgres" database. After running

heroku pg:psql and
\dF,

I can see that Heroku has a preset stop dictionary that I want - Russian (pg_catalog.russian), so there is no need to create a new dictionary (although I see many questions about this as well).

According to the postgres docs, one can change this by altering the postgresql.conf, which is not applicable in this case, or by setting it for an individual session. I've tried setting it through the CLI with

SET default_text_search_config = 'pg_catalog.russian';

However, as soon as I exit the CLI, it reverts to the initial pg_catalog.english.

I'm using Prisma, so I've tried applying a migration of this as well, thinking that the issue was the session not persisting after I closed the CLI. This also was not successful.

Is there a way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

骑趴 2025-02-17 01:18:16

也可以在数据库级别上设置默认值

如果您在整个群集中使用了相同的文本搜索配置,则可以在postgresql.conf中使用该值。要在整个集群中使用不同的配置,但是在任何一个数据库中使用相同的配置,请使用Alter Database ... Set。否则,您可以在每个会话中设置default_text_search_config

假设您的数据库称为abcdefg,请尝试以下操作:

ALTER DATABASE abcdefg SET default_text_search_config TO 'pg_catalog.russian';

我怀疑这将在Heroku的产品中起作用,但没有尝试过。

It is also possible to set the default at the database level:

If you are using the same text search configuration for the entire cluster you can use the value in postgresql.conf. To use different configurations throughout the cluster but the same configuration within any one database, use ALTER DATABASE ... SET. Otherwise, you can set default_text_search_config in each session.

Assuming your database is called abcdefg, try the following:

ALTER DATABASE abcdefg SET default_text_search_config TO 'pg_catalog.russian';

I suspect this will work on Heroku's offering, but have not tried it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文