LoginSignup
0
1

More than 3 years have passed since last update.

PostgreSQL: 現在のスキーマを切り替えるクエリには `set search_path = スキーマ名;`

Last updated at Posted at 2019-06-14

PostgreSQLで現在のスキーマを切り替える方法を紹介する。

psqlコマンドで対話ターミナルを開く:

psql

対話ターミナル上で下記クエリを実行すると、現在のスキーマが切り替わる:

set search_path = スキーマ名;

実行例

root=# select current_schema();
 current_schema
----------------
 public
(1 row)

root=# set search_path = posts;
SET

root=# select current_schema();
 current_schema
----------------
 posts
(1 row)

関連

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1