0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PostgreSQL SQL メモ

Last updated at Posted at 2025-11-02

背景・目的

PostgreSQLのコマンドについて、目的別にまとめていきます。(随時更新します。)

まとめ

分類 目的
設定 ページャーを無効化する
ディクショナリの確認 テーブル一覧を確認する
主キーの一覧を確認する
ビューの一覧を確認する
プロシージャーの一覧を確認する

実践

前提

Aurora PostgreSQL 16.9を利用しています。

ページャーを無効化する

\pset pager off

テーブル一覧を確認する

  SELECT table_name 
    FROM information_schema.tables 
   WHERE table_schema = 'XXXXX'
     AND table_type = 'BASE TABLE'
ORDER BY table_name;

主キーの一覧を確認する

  SELECT 
         tc.table_name,
         tc.constraint_name
    FROM information_schema.table_constraints tc
   WHERE tc.table_schema = 'XXXXX' 
     AND tc.constraint_type = 'PRIMARY KEY'
ORDER BY tc.table_name;

ビューの一覧を確認する

  SELECT table_name 
    FROM information_schema.views 
   WHERE table_schema = 'XXXXX'
ORDER BY table_name;

プロシージャーの一覧を確認する

  SELECT routine_name 
    FROM information_schema.routines 
   WHERE routine_schema = 'XXXXX' 
     AND routine_type = 'PROCEDURE'
ORDER BY routine_name;
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?