From 4c35f89a5523eda144e7c4180e8773033ab1edff Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 22 二月 2023 14:31:20 +0800 Subject: [PATCH] 1 --- data/db_cx.sql | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/data/db_cx.sql b/data/db_cx.sql index 097ed15..2175e83 100644 --- a/data/db_cx.sql +++ b/data/db_cx.sql @@ -29,10 +29,20 @@ show max_connections; select count(1) from pg_stat_activity; -select c.relname "tab", cast(obj_description(c.oid) as varchar) "desc", a.attnum "num", a.attname "col", -t.typname "type",concat_ws('', t.typname,SUBSTRING(format_type(a.atttypid, a.atttypmod) from '(.*)')) "type2", d.description "bak" -- select * -from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join pg_class c -on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and reltype>0 and relnamespace in (29257,20582)--135502,69701 +-- 鏌ヨ琛ㄦ灦鏋勫拰琛ㄥ悕 +select oid,table_catalog,table_schema,table_name +from information_schema.tables t1, pg_class t2 +where table_schema = 'bd' and t1."table_name" = t2.relname +order by table_catalog,table_schema,table_name; + +-- 鏌ヨ瀛楁淇℃伅 +select e.table_catalog, e.table_schema, c.relname "tab", cast(obj_description(c.oid) as varchar) "desc", a.attnum "num", a.attname "col", + d.typname "type", concat_ws('', d.typname, SUBSTRING(format_type(a.atttypid, a.atttypmod) from '(.*)')) "type2", b.description "bak" +from pg_attribute a left join pg_description b on b.objoid = a.attrelid and b.objsubid = a.attnum + left join pg_class c on a.attrelid = c.oid + left join pg_type d on a.atttypid = d.oid + left join information_schema.tables e on e.table_name = c.relname +where a.attnum >= 0 and reltype > 0 and a.attname = 'verid' and d.typname != 'int4' --and relnamespace in (29257,20582) order by c.relname desc, a.attnum asc; select pg_constraint.conname as pk_name,pg_attribute.attname as colname,pg_type.typname as typename from pg_constraint inner join pg_class @@ -47,7 +57,7 @@ select a.* from lf.sys_menu a, rs b where a.pid=b.id ) select * FROM rs order by order_num; -- 鏌ヨ鑿滃崟 -with recursive rs as( +with recursive rs as ( select * from lf.sys_dep where name='涓浗鐭虫补澶╃劧姘旂閬撳伐绋嬫湁闄愬叕鍙�' union select a.* from lf.sys_dep a, rs b where a.pid=b.id -- Gitblit v1.9.3