当前位置: 首页 > wzjs >正文

成都公安网站备案兰州seo公司

成都公安网站备案,兰州seo公司,web设计个人博客首页,怎么认证网站【MySQL\Oracle\PostgreSQL】迁移到openGauss数据出现的问题解决方案 问题1:序列值不自动刷新问题 下面SQL只针对单库操作以及每个序列只绑定一张表的情况 -- 自动生成的序列,设置序列值 with sequences as (select *from (select table_schema,table_…

【MySQL\Oracle\PostgreSQL】迁移到openGauss数据出现的问题解决方案

问题1:序列值不自动刷新问题
下面SQL只针对单库操作以及每个序列只绑定一张表的情况

-- 自动生成的序列,设置序列值
with sequences as (select *from (select table_schema,table_name,column_name,pg_get_serial_sequence(format('%I.%I', table_schema,table_name), column_name) as auto_seq, --<<自动(string_to_array(column_default, E'\''))[2]             as col_seq   --<<手动from information_schema.columnswhere table_schema not in ('pg_catalog', 'information_schema')and column_default ILIKE 'nextval(%'and table_schema = 'usc') t
--                    where auto_seq is not null),maxvals as (select table_schema,table_name,column_name,auto_seq,col_seq,(xpath('/row/max/text()',query_to_xml(format('select max(%I) as max from %I.%I', column_name, table_schema,table_name),true, true, '')))[1]::text::bigint as max_val,(xpath('/row/cur/text()',query_to_xml(format('select last_value as cur from %I.%I',table_schema, col_seq),true, true, '')))[1]::text::bigint as cur_valfrom sequences)
select table_schema,table_name,column_name,auto_seq,col_seq,cur_val,coalesce(max_val, 0) as max_val,setval(col_seq, coalesce(max_val, 1)) --<<设置序列值
from maxvals;

问题2:
字符类型为空字符串迁移后会变成null排查,需要考虑大表问题,防止慢SQL

-- 数据库迁移出现null/空字符串 排除
with t as (select table_schema,table_name,column_name,(xpath('/row/cnt/text()',query_to_xml(format(E'select count(*) as cnt from %I.%I where %I = \'\'', table_schema,table_name, column_name),true, true, '')))[1]::text::bigint as null_cnt
from information_schema.columns
where table_schema not in ('pg_catalog', 'information_schema')and table_schema = 'usc'and is_nullable = 'NO'and udt_name in ('varchar', 'text', 'bpchar'))
select * from t where null_cnt > 0;

问题3:
时间精度问题,导致时间范围查询失败。批量调整时间字段精度

DO
$$DECLAREr RECORD;BEGINFOR r INselect table_name, column_name, udt_namefrom information_schema.columnswhere table_schema not in ('pg_catalog', 'information_schema')and table_schema = 'usc'and udt_name in ('timestamp','timestamptz')LOOPEXECUTE 'ALTER TABLE ' || r.table_name || ' ALTER COLUMN ' || r.column_name || ' TYPE ' || r.udt_name ||'(0)';END LOOP;END
$$;
http://www.dtcms.com/wzjs/423098.html

相关文章:

  • 住房和城乡建设部网站住房补贴企业推广app
  • 企业建设营销型网站步骤网络营销的主要方法
  • 徐州手机网站建设公司百度推广关键词和创意
  • 网站搭建中114514西安 做网站
  • 公司网站建设案例市场运营和市场营销的区别
  • 网站建设的生存期模型网站多少钱
  • 网站开发四点注意事项正规推广赚佣金的平台
  • 工程网站建设系统优化助手
  • 输入网址跳到别的网站怎么提高关键词搜索排名
  • 美国旅游网站排名网络seo关键词优化技术
  • 湖南网站备案2023能用的磁力搜索引擎
  • 手机网站 win8风格友情链接管理系统
  • 做兼职的设计网站佛山关键词排名效果
  • 注册域名之后如何建设网站长沙seo排名扣费
  • 网页微博如何注销站内优化
  • gzip压缩网站武汉seo关键字优化
  • 嘉定网站建设哪家好淘宝数据分析
  • 大连网站建设-网龙科技草根站长工具
  • 通化网站建设单位网上销售培训课程
  • 商丘做网站汉狮网络郑州网站优化外包顾问
  • 天河网站建设制作广东seo网站推广
  • 网站做等保二级收费多少seo推广员是做什么的
  • ftp网站怎么建平台推广营销
  • wordpress 文章作者搜外seo
  • wordpress付费下载功能沈阳seo排名外包
  • 郑州建设信息网网四川旅游seo整站优化
  • 宿迁网站制作公司百度在线客服中心
  • 永州网站建设收费标准搜索指数查询
  • 咪咕动态网站怎么做计算机培训班
  • 公司做网站的费用如何记账seo综合查询