惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - 疯子110

Vue3 + Vite + Ts 报错:Property ‘ ‘ does not exist on type ‘never‘ activiti部署流程后act_re_procdef表中无流程定义信息 【转】openEuler欧拉系统重置密码 【转】nginx开启https导致springboot无法获取正确浏览器请求地址问题 【转】SLF4J(W): No SLF4J providers were found. 解决方法 vue项目放在springboot项目里后,刷新页面会显示whitelabel error page Vue3 echarts tooltip添加点击事件(最简版) Vue3富文本编辑器wangEditor 5使用总结【转载】 解决 vue3 中 Proxy(Object) 对象无法直接读取或使用 centos7-分区2T以上大硬盘[转】 关于mybatis进行sql查询字段值为null而不显示问题解决办法 Vue3 - 项目中使用 debugger 在 chrome 谷歌浏览器中失效 vue项目error Unexpected ‘debugger‘ statement no-debugger报错 vue项目中 报错 error ‘xxx‘ is assigned a value but never used 在vue中使用leaflet加载地图【转载】 无法加载文件 D:\Program Files\xxxxx\vue.ps1,因为在此系统上禁止运行脚本”的解决方法 - 疯子110 Vue3安装配置+VSCode开发环境搭建,超详细保姆级教程(图文) 【cesium重新梳理】1.cesium知识整理 【cesium】修改底图颜色为蓝色科技范儿
【转】将postgresql表名和字段名统一转换为小写
疯子110 · 2025-02-18 · via 博客园 - 疯子110

文章来源:https://blog.csdn.net/yiqiu_0130/article/details/143331804

在使用postgresql创建表、函数、字段的命名时,使用小写在开发过程中会减少不必要的麻烦,所以在命名时,使用小写。如果是迁移的表信息时,则可以使用执行脚本的方法,将表名和列名统一转换为小写。

自定义执行函数
CREATE OR REPLACE FUNCTION "public"."exec"("sqlstring" varchar)
RETURNS "pg_catalog"."varchar" AS $BODY$
declare
res varchar(50);
BEGIN
EXECUTE sqlstring;
RETURN 'ok';
END
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
注:在查询窗口中执行,即可创建 “exec” 函数。

将所有数据库中所有表的列名转为小写
SELECT
exec('alter table "' || table_name || '" rename column "' || column_name || '" to ' || lower( column_name ) || ';')
FROM
information_schema.COLUMNS
WHERE
table_schema = 'public'
AND column_name <> lower(column_name);
注:在查询窗口中执行,即可将数据库中所有表的字段命名转换为小写格式。

将所有数据库中所有表名转为小写
SELECT
exec ( 'alter table "' || table_name || '" rename to ' || lower( table_name ) || ';' )
FROM
information_schema.tables
WHERE
table_schema='public'
and table_catalog = '数据库名称'
and table_name <> lower(table_name);
注:将“数据库名称”替换为业务数据库名称,在查询窗口中执行,即可将数据库中所有表名称转换为小写格式
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/yiqiu_0130/article/details/143331804