login to gitlab-Postgre-db:
gitlab-rails dbconsole
gitlab-psql -d gitlabhq_production
postgres=# \c dvdrental
You are now connected to database "dvdrental" as user "postgres".
\l = SELECT datname FROM pg_database;
gitlabhq_production=> \d
#list all objects of the db. include table, sequence, and so on.
\d = select * from
gitlabhq_production=> \dt
(\dt + :#show size)
(\dt tablename :#show table columns)
#list all tables of the db
SELECT *
FROM pg_catalog.pg_tables
WHERE schemaname != 'pg_catalog' AND
schemaname !=
schemaname != 'information_schema';
schemaname != 'information_schema';
--'テーブル名'に存在する列一覧を取得
select * from information_schema.columns
where table_name='テーブル名' order by ordinal_position;
没有评论:
发表评论