lightdb UPDATE INDEXES自动分区转换支持全大写索引名

文章目录

背景

普通表转分区表,Oracle中的写法习惯索引名会使用大写并用双引号包起来。这导致LightDB 在匹配索引名时提示索引名不存在。

LightDB 23.3.02增量版本对此进行了支持。

示例

准备环境

create database test_oracle with lightdb_syntax_compatible_type  oracle;
\c test_oracle

创建一张普通表

create table tb_list1
(
    city_id integer not null,
    city_name varchar2(30) not null,
    city_state varchar2(20) not null,
    city_amount integer not null
);

创建索引

create index TB_LIST_I01 on tb_list1(city_amount);
create index TB_LIST_I02 on tb_list1(city_name);

将普通表转为分区表

alter table tb_list1 MODIFY partition by range(city_amount)
    (
    partition tb_list1_amount1 values less than (101),
    partition tb_list1_amount2 values less than (105)
    ) ONLINE UPDATE INDEXES
    (
    "TB_LIST_I01" global,
    "TB_LIST_I02" local
    );

在LightDB 23.03.02之前的版本会提示索引找不到,原因是创建索引时没有带引号,而ALTER时携带了引号。

查看表信息

lightdb@test_oracle=# \d+ tb_list1
                                 Partitioned table "public.tb_list1"
   Column    |     Type     | Collation | Nullable | Default | Storage  | Stats target | Description 
-------------+--------------+-----------+----------+---------+----------+--------------+-------------
 city_id     | integer      |           | not null |         | plain    |              | 
 city_name   | varchar2(30) |           | not null |         | extended |              | 
 city_state  | varchar2(20) |           | not null |         | extended |              | 
 city_amount | integer      |           | not null |         | plain    |              | 
Partition key: RANGE (city_amount)
Indexes:
    "tb_list_i01" btree (city_amount)
    "tb_list_i02" btree (city_name)
Partitions: "tb_list1$p$tb_list1_amount1" FOR VALUES FROM (MINVALUE) TO (101),
            "tb_list1$p$tb_list1_amount2" FOR VALUES FROM (101) TO (105)
相关推荐
紫无之紫5 个月前
LightDB 函数/存储过程支持在任意位置使用默认值【24.1】【oracle 兼容】
数据库·lightdb·函数默认值
紫无之紫8 个月前
LightDB - oracle_fdw 过滤条件下推增强【24.1】
oracle·lightdb·oracle_fdw·下推
星辰bitone9 个月前
lightdb plorasql集合类型新增可变数组
数据库·lightdb
星辰bitone10 个月前
lightdb MySQL兼容模式下timestampdiff函数支持首参无引号
数据库·lightdb
星辰bitone10 个月前
lightdb 普通用户拥有XMLTYPE类型的访问权限
数据库·postgresql·lightdb
星辰bitone10 个月前
lightdb oracle模式支持sys_refcursor类型
数据库·lightdb