linux 在安装pgsql的服务器上
root是用户名,test是数据库名
psql -U root -d test
登录后显示,12,6是版本号
psql (12.6)
查询所有表
sql
\dt
查询表结构
sql
\d+ table_name
查询表所属
sql
\dp manual_logistics_log
sql
SELECT n.nspname AS table_schema,
c.relname AS table_name,
r.rolname AS tableowner
FROM pg_class c
JOIN
pg_namespace n ON n.oid = c.relnamespace
JOIN
pg_roles r ON r.oid = c.relowner
WHERE c.relkind = 'r'
AND c.relname = 'parent_info';
更改表所属
sql
alter table table_name
owner to root;