table_catalog 和 table_schema 的区别 table_catalog 比 table_schema比和 高一级 pg_description表 想要查看注释肯定离不开pg_description表。 共有4列: 注: 根据表名找到oid之后,这里要用objoid关联(不要用classoid哦)。 查看表的注释: select oid from pg_class where relname='t_user'; select * from ...
SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema = 'public'; 这个查询将返回public模式下的所有数据表及其相关信息。 如果您想查看所有数据库的所有表,而不限于public模式,可以使用以下查询: SELECT table_catalog AS database_name, table_schema, table_name FROM information_...
table_catalog, table_schema, table_name, column_name, ordinal_position, is_nullable, data_type等 查询测试表的字段信息: select*frominformation_schema.columnswheretable_schema='schema2023'andtable_name='some_info' 结果: ben发布于博客园 综合查询:包括字段注释 sql语句: selecttable_catalog, table_sche...
6、使用视图查询表名及字段 SELECTdistinctTABLE_NAME,COLUMN_NAMEFROMINFORMATION_SCHEMA.COLUMNSWHEREtable_schema='ods'ANDtable_nameNOTSIMILARTO'%_20[0-9]+' 二、会话及锁信息 1、查询所有会话 SELECTsa.*FROMpg_catalog.pg_stat_activity sa 三、导入导出命令 1、数据库导入导出 (1)从源数据库导出结构 pg...
WHERE table_schema NOT IN ('pg_catalog', 'information_schema') AND table_name !~ '^pg_'; 1. 2. 3. 4. 3 当前数据库的用户 SELECT usename FROM pg_user; 4 列出某个表的字段 SELECT a.attname FROM pg_class c, pg_attribute a, pg_type t ...
select table_catalog,table_schema,table_name,table_type from information_schema.tables where table_schema notin('pg_catalog','information_schema','dbe_perf'); 可以使用表名直接访问public的表(不需要加public模式名前缀)。 访问数据库下其他模式的表需要指定模式名前缀。
pg_catalog|pg_description|table|postgres|permanent|328kB|pg_catalog|pg_enum|table|postgres|permanent|0bytes|pg_catalog|pg_event_trigger|table|postgres|permanent|8192bytes|pg_catalog|pg_extension|table|postgres|permanent|48kB|pg_catalog|pg_file_settings|view|postgres|permanent|0bytes|pg_catalog|pg_...
) AS foo ON t.tablename = foo.ctablename AND t.schemaname = foo.schemaname WHERE t.schemaname NOT IN ('pg_catalog', 'information_schema') ORDER BY 1,2; 查询重复索引的脚本 代码语言:javascript 复制 SELECTpg_size_pretty(sum(pg_relation_size(idx))::bigint)assize,(array_agg(idx))[1...
CREATE TABLE "public"."t_user" ( "id" int8 NOT NULL DEFAULT nextval( 'upms_log_id_seq' :: regclass ), "name" VARCHAR ( 255 ) COLLATE "pg_catalog"."default", "phone" VARCHAR ( 255 ) COLLATE "pg_catalog"."default", "birthday" TIMESTAMP ( 6 ), "sex" VARCHAR ( 64 ) COLLATE...
CREATE OR REPLACE FUNCTION "public"."f_inittables1"(arr _text)RETURNS "pg_catalog"."void" AS $BODY$DECLAREscount INTEGER;rownum integer := 1;currsnum text;strSQL text;BEGINscount:=array_length(arr,1);while rownum <= scount LOOPcurrsnum:=arr[rownum];RAISE NOTICE '这里是%', currsnum...