Skip to content

Instantly share code, notes, and snippets.

View yuyao110120's full-sized avatar

DerekMonster yuyao110120

View GitHub Profile
@yuyao110120
yuyao110120 / table_structure.sql
Last active March 1, 2021 07:25
[pg表结构查询]查询 pg 表结构 #sql
select a.attnum AS "序号",
c.relname AS "表名",
cast(obj_description(relfilenode,'pg_class') as varchar) AS "表名描述",
a.attname AS "列名",
concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '.∗.∗')) as "字段类型",
d.description AS "备注"
from pg_attribute a
LEFT JOIN pg_class c on a.attrelid = c.oid
LEFT JOIN pg_type t on a.atttypid = t.oid
LEFT JOIN pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum
@yuyao110120
yuyao110120 / replace_cmd.sh
Last active February 28, 2021 23:24
[批量替换命令]批量查询并替换文件文本内容 #cmd
grep "abc" * -R | awk -F: '{print $1}' | xargs sed -i 's/abc/abcde/g'