小编THK*_*THK的帖子

如何将模式附加到 postgresql 数据库默认 search_path?

我已经知道如何设置每个数据库或用户的 search_path (将数据库设置 search_path 为 schema1、schema2,...)。

我想做的是将架构附加到默认搜索路径。我知道我可以获得当前的搜索路径(显示 search_path),但这可能在会话期间被更改。

目的是这样的:

create schema postgis;
set search_path to postgis;
create extension postgis;
alter database the_db set search_path to <the current default>, postgis;
Run Code Online (Sandbox Code Playgroud)

我可以手动执行此操作,但我想将其添加到一个可以在用户更改会话搜索路径后调用的函数中。

postgresql

5
推荐指数
1
解决办法
1811
查看次数

标签 统计

postgresql ×1