一.opengauss是什么?安装步骤?产品说明?
docs.opengauss.org/zh/docs/3.0…
二.创建用户
create user epms with createdb identified by 'xys@123...';
三.创建表空间
create tablespace epms owner epms relative location 'tablespace/epms' ;
四.创建数据库
CREATE DATABASE platform_power OWNER epms DBCOMPATIBILITY 'B' tablespace epms;
五.创建序列
CREATE SEQUENCE class_rule_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9999999999999 START WITH 1 CACHE 10;
六.数据迁移
Navicat ,数据迁移后的主键序列值需要注意起始值
七.常见问题
1.对象名称不能重复,如索引名称
2.group by 写法
3.scheme 设置 SHOW SEARCH_PATH;SET SEARCH_PATH TO epms, public;
4.自动增长
select concat('CREATE SEQUENCE ' , LOWER(TABLE_NAME) , '_id_seq INCREMENT 1 MINVALUE 10000000000 MAXVALUE 9999999999999999 START WITH 10000000000 CACHE 10 ;') as f from COLUMNS where TABLE_SCHEMA = 'platform-power' and EXTRA = 'auto_increment'
union
select concat('alter table ' , LOWER(TABLE_NAME) , ' alter column ' , LOWER(COLUMN_NAME) , ' set default nextval(''', LOWER(TABLE_NAME), '_id_seq'') ;' ) as f from COLUMNS where TABLE_SCHEMA = 'platform-power' and EXTRA = 'auto_increment'
) a where a.f like '%tb_token_record%'
5.特殊符号 select pos.id as value
6.大小写问题
7.数字类型的大小调整 int4 int8 int16
8.批量插入:需要修改ID 输入类型为 INPUT ,使用序列提前去ID @KeySequence(value="tb_organization_id_seq") @TableId(type = IdType.INPUT)
八.系统表
information_schema.tables ,information_schema.COLUMNS ,information_schema.sequences