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

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Darknet – Hacking Tools, Hacker News & Cyber Security
N
News and Events Feed by Topic
N
News | PayPal Newsroom
SecWiki News
SecWiki News
P
Privacy International News Feed
T
Troy Hunt's Blog
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
L
LINUX DO - 热门话题
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Security Latest
Security Latest
AWS News Blog
AWS News Blog
S
Secure Thoughts
W
WeLiveSecurity
H
Heimdal Security Blog
T
Threat Research - Cisco Blogs
I
Intezer
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security @ Cisco Blogs
G
GRAHAM CLULEY
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Spread Privacy
Spread Privacy
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
Cisco Talos Blog
Cisco Talos Blog
雷峰网
雷峰网
Cloudbric
Cloudbric
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
Latest news
Latest news
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
D
Docker
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
H
Help Net Security
博客园 - 司徒正美
TaoSecurity Blog
TaoSecurity Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Check Point Blog
博客园 - 叶小钗

PostgreSQL

五年过去了,结论有什么变化吗? 适配信创数据库的人的精神状态 be like - V2EX 用了十几年的 MySQL 了,突然发现 PostgreSQL 可能更加适合我,大家怎么看? - V2EX postgresql 多进程改多线程 - V2EX 二键安装一个 postgresql 服务 - V2EX 通过 pg_roaringbitmap 优化标签查询的话,有没有必要做高频标签映射和结合普通复合索引? - V2EX PostgreSQL + TimescaleDB 方案不按主键索引走,有什么办法吗? - V2EX 看看大家现在用 pg 的最佳实践是怎么样的 - V2EX 用 PostgreSQL 存图片等 binary 有什么坑吗 - V2EX [求助] 在哪个网址能够下载 PostgresSQL 9.3.0 版本的 Windows 二进制安装包?官方/ftp/old/binary 里没有。 - V2EX [请教]pgvector 的性能问题 - V2EX 多笔记本离线 PostgreSQL 数据库同步问题: UUID vs 自增主键 - V2EX PostgreSQL 通过分 Database 做多租户可行吗? PostgreSQL 多租户的正确姿势 - V2EX Postgresql 放 K8S 里,大家目前都用的什么方案呢? - V2EX 2025 年 postgresql 有什么优秀的备份解决方案 - V2EX 有大神研究过 pg_resetwal 的原理吗,为什么会丢 user 表的数据 - V2EX 按照 stackoverflow 教程执行 pg_resetwal, postgresql 的数据库被清空了 - V2EX 求国内高性价比的 postgresql 服务,纳米项目 - V2EX 请教一个关于 PostgreSQL 连接被 Server 关闭的问题 - V2EX PostgreSQL 18 JSONB 增加能取代 MongoDB 吗? - V2EX PostgreSql Oracle 迁移 postgreSQL ,有什么经验分享 - V2EX 有什么权限管理最佳实践吗 - V2EX 请教 PostgreSQL 和 PostGIS 使用问题 - V2EX pg 的毫秒级时间戳转换 - V2EX 关于 PostgreSQL 中的 max_connections 和 pg_stat_activity 的疑惑 - V2EX 目前国内最高性价比的 postgresql 服务是? - V2EX 新手,请问 postgres 怎么配置 vacuum - V2EX 学习 PostgreSQL,有什么资料推荐? - V2EX Apache AGE 和 Neo4j 哪个更好? - V2EX 有没有像 Citus 那样方便分片的图数据库? - V2EX 怎样使用 C 语言访问 PostgreSQL 集群? 小系统 数据库 mysql 和 postgresql 比对 和 wordpress 数据库技术选型 PostgreSQL 没有 on update current_timestamp 感觉好麻烦 - V2EX 主从同步使用的端口号可以和数据库端口号不同吗? - V2EX 为什么有时 PostgreSQL 有时会表现得比较卡? - V2EX 第一次使用 PostgreSQL,连建表都不会,请教点经验 Java 有没有针对 PostgreSQL 好用一点的 ORM - V2EX 请教,有无简单易用的 PostgreSQL 表结构、数据的同步工具? - V2EX PostgreSQL 启动失败 - V2EX PostgreSQL 数据库 正常情况下指定了 locale=C 与 encoding=UTF8 (最简单) - V2EX 错误迁移 pgsql 导致日志报 warning,请问如何解决? - V2EX 从 Mongodb 到 PostgreSQL 的大迁移 有无 pg 的入门精进博客或者视频推荐 新的 PostgreSQL 语言插件 PL/PRQL - V2EX 请教一个经典的 postgres 的 sql 怎么写 - V2EX 洗数据:如何将 Contact 和 ContactTag 多对多关联起来 Postgres 在中国还能起来么? - V2EX PostgreSQL 17 增加增量备份的功能 - V2EX
有什么不通过写脚本的方式,将 postgreSQL 的建表语句转换为 doris 的建表语句吗? - V2EX
sirthisman · 2024-03-01 · via PostgreSQL
sirthisman

8

sirthisman      2024 年 3 月 11 日

尝试自己写个 SQL 拼一下:
--拼 Starrocks 建表语句
select
'CREATE TABLE IF NOT EXISTS '||table_schema||'.'||table_name||' (
' tb
,string_agg(column_all,',
' order by ordinal_position)||'
)
' cb
,'COMMENT '||'"'||table_comment||'"'
,分桶键
from(
select
c.column_name||' '||case when c.data_type in('character','character varying','text') then 'string'
when c.data_type in('numeric','real') then 'decimal'||(case when COALESCE(character_maximum_length,numeric_precision) is not null and numeric_scale>0
then '('||COALESCE(character_maximum_length,numeric_precision)||','||numeric_scale ||')'
else '' end)
when c.data_type like 'time%' then 'datetime'
when c.data_type like 'double%' then 'double'
else c.data_type end||' comment '||'"'||c.column_name||'"' column_all
,t.table_schema
,t.table_name
,a.table_comment
,c.ordinal_position
,c.column_name
,c.data_type
,COALESCE ( character_maximum_length, numeric_precision, - 1 ) AS LENGTHTYPE
,numeric_scale
,a.column_comment
,分桶键
from information_schema.tables t
left join information_schema.COLUMNS c on t.table_name = c.table_name and t.table_schema=c.table_schema
left join (select
b.nspname,
a.relname,
cast( obj_description (a.relfilenode, 'pg_class' ) AS VARCHAR ) AS table_comment,
d.attname,
c.description as column_comment
from pg_class a
left join pg_namespace b on a.relnamespace=b.oid
left join pg_description c on c.objoid = a.oid
left join pg_attribute d on c.objoid=d.attrelid and d.attnum = c.objsubid
left join pg_type o on d.atttypid=o.oid
) a on a.nspname=c.table_schema and a.relname = c.table_name and a.attname=c.column_name
left join (select
table_schema
,table_name
,'DISTRIBUTED BY HASH('||case when ordinal_position=1 then column_name end||') PROPERTIES ("replication_num" = "1");' 分桶键
from information_schema.COLUMNS
where ordinal_position=1
) p on p.table_name = c.table_name and p.table_schema=c.table_schema
where t.table_schema in ('tds'/*,'ext','rds','rpt','udt'*/)
order by t.table_schema
,t.table_name
,c.ordinal_position
) d
group by table_schema
,table_name
,table_comment
,分桶键