LightDB24.1 Sequence支持设置minvalue小于INT64_MIN

背景介绍

Oracle数据库支持设置sequence的minvalue为-1000000000000000000000000000,在用户迁移到LightDB时,sequence设置minvalue为-1000000000000000000000000000会报错。为了兼容Oracle数据库的使用习惯,在LightDB24.1版本中,对于minvalue小于INT64_MIN(-9223372036854775808)做了处理,使得minvalue值被设置为INT64_MIN。

使用约束:

  • oracle兼容模式下生效

使用示例

  1. 在oracle兼容模式下
lightdb@oracle_test=# show lightdb_dblevel_syntax_compatible_type ;
 lightdb_dblevel_syntax_compatible_type 
----------------------------------------
 Oracle
(1 row)

lightdb@oracle_test=# create sequence s1 minvalue -1000000000000000000000000000;
NOTICE:  minvalue out of range, set sequence min value to -9223372036854775808
CREATE SEQUENCE
lightdb@oracle_test=# \d+ s1
                                           Sequence "public.s1"
  Type  |        Start         |       Minimum        |       Maximum       | Increment | Cycles? | Cache 
--------+----------------------+----------------------+---------------------+-----------+---------+-------
 bigint | -9223372036854775808 | -9223372036854775808 | 9223372036854775807 |         1 | no      |     1

lightdb@oracle_test=# 
  1. 非oracle兼容模式
lightdb@postgres=# show lightdb_dblevel_syntax_compatible_type ;
 lightdb_dblevel_syntax_compatible_type 
----------------------------------------
 off
(1 row)

lightdb@postgres=# 
lightdb@postgres=# create sequence s1 minvalue -1000000000000000000000000000;
ERROR:  value "-1000000000000000000000000000" is out of range for type bigint
lightdb@postgres=# \d+ s1
Did not find any relation named "s1".
lightdb@postgres=# 
  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值