我正在使用别名登录我的 Postgres 12(在 Windows 10 上运行)数据库,该别名解析为
PGPASSWORD=$DB_PASSWORD psql -U${DB_USER} $DB_NAME
我想找到一种方法来告诉 Postgres 在登录时默认使用哪个模式,无论是在命令行还是其他方式。我尝试设置“search_path”...
> login_to_my_db
psql (12.11)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
my_db_name=> show search_path;
search_path
-----------------
"$user", public
(1 row)
my_db_name=> set search_path = 'my_schema';
SET
my_db_name=> show search_path;
search_path
-------------
my_schema
(1 row)
但是一旦我注销并重新登录,搜索路径设置就消失了
my_db_name=> \q
> login_to_my_db
psql (12.11)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
my_db_name=> show search_path;
search_path
-----------------
"$user", public
(1 row)
我如何保存它或至少告诉 psql 登录时使用什么模式?