LightDB 序列支持NOMAXVALUE功能

功能介绍

Oracle数据库在创建sequence的时候可以支持设置nomaxvalue,这样的SQL在LightDB 23.3版本之前都是执行失败的。为了方便Oracle用户迁移到LightDB上,在LightDB 23.3版本上,增加了sequence支持设置nomaxvalue的语法兼容。
nomaxvalue内部逻辑和PostgreSQL数据库sequence原本就支持的NO MAXVALUE相同。

使用说明

  1. 创建sequence时指定nomaxvalue
lightdb@lt_test=# create sequence s1 nomaxvalue;
CREATE SEQUENCE
lightdb@lt_test=# \d+ s1
                             Sequence "public.s1"
  Type  | Start | Minimum |       Maximum       | Increment | Cycles? | Cache 
--------+-------+---------+---------------------+-----------+---------+-------
 bigint |     1 |       1 | 9223372036854775807 |         1 | no      |     1

lightdb@lt_test=# 
  1. 修改sequence时指定nomaxvalue
lightdb@lt_test=# alter sequence s1 maxvalue 100000;
ALTER SEQUENCE
lightdb@lt_test=# \d+ s1
                       Sequence "public.s1"
  Type  | Start | Minimum | Maximum | Increment | Cycles? | Cache 
--------+-------+---------+---------+-----------+---------+-------
 bigint |     1 |       1 |  100000 |         1 | no      |     1

lightdb@lt_test=# alter sequence s1 nomaxvalue;
ALTER SEQUENCE
lightdb@lt_test=# \d+ s1
                             Sequence "public.s1"
  Type  | Start | Minimum |       Maximum       | Increment | Cycles? | Cache 
--------+-------+---------+---------------------+-----------+---------+-------
 bigint |     1 |       1 | 9223372036854775807 |         1 | no      |     1

lightdb@lt_test=# 
  1. nomaxvalue不可以和no maxvalue或者maxvalue一起使用
lightdb@lt_test=# alter sequence s1 maxvalue 10000 nomaxvalue;
ERROR:  conflicting or redundant options
LINE 1: alter sequence s1 maxvalue 10000 nomaxvalue;
                                         ^
lightdb@lt_test=# alter sequence s1 no maxvalue nomaxvalue;
ERROR:  conflicting or redundant options
LINE 1: alter sequence s1 no maxvalue nomaxvalue;
                                      ^
lightdb@lt_test=# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值