PG数据库如何查看模式schema相关信息
一 查看schema信息
进到库huanyu_secd里
postgres=# \c huanyu_secd
查看库huanyu_secd里schema信息
SELECT pn.oid AS schema_oid, iss.catalog_name, iss.schema_owner, iss.schema_name FROM information_schema.schemata iss INNER JOIN pg_namespace pn ON pn.nspname = iss.schema_name;
二 查看huanyu_secd库里public模式下的表
select * from pg_tables where schemaname = 'public';
三 查看表t_bd_generalasstacttyp_r3的字段信息
SELECT table_schema,
table_name,
column_name,
ordinal_position,
column_default,
data_type,
udt_name,
(
SELECT pg_catalog.col_description(c.oid, sc.ordinal_position::INT)
FROM pg_catalog.pg_class c
WHERE c.oid = (SELECT ('"' || sc.table_name || '"')::REGCLASS::OID)
AND c.relname = sc.table_name
) AS comment
FROM information_schema.columns sc
WHERE table_schema = 'public'
AND table_name = 't_bd_generalasstacttyp_r3' ;
PG数据库如何查看模式schema相关信息
本文2024-09-23 01:13:14发表“云苍穹知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-cangqiong-144549.html