网站开启gzip压缩,一键优化大师,代理公司注册,免费广告设计软件LightDB 表名与包名不能重复
从 LightDB 23.3 版本开始表名和包名不能重复#xff0c;与 oracle 一致。原先已已支持包名和schema名不能重复。
背景
在之前版本在同一schema 下可以创建相同名字的表和包。这会导致在存储过程中使用%type指定变量类型时#xff0c;如果存在…LightDB 表名与包名不能重复
从 LightDB 23.3 版本开始表名和包名不能重复与 oracle 一致。原先已已支持包名和schema名不能重复。
背景
在之前版本在同一schema 下可以创建相同名字的表和包。这会导致在存储过程中使用%type指定变量类型时如果存在相同的表名和包名会使用表的可能会导致结果不符合预期在表不存在的情况下才会引用包的。如下所示
chuhxtest_o# create table t1(key1 date);
CREATE TABLE
chuhxtest_o# create package t1 ISkey1 real;end;
/
CREATE PACKAGE
chuhxtest_o# declareval t1.key1%type 20221212;begindbms_output.serveroutput(true);dbms_output.put_line(cast(val as varchar2(100)));
end;
/
2022-12-12
DO
chuhxtest_o# drop table t1;
DROP TABLE
chuhxtest_o# declareval t1.key1%type 20221212;begindbms_output.serveroutput(true);dbms_output.put_line(cast(val as varchar2(100)));
end;
/
2.0221212e07
DO在 oracle 下包名与表名不能相同故需要支持此特性。
案例
lightdbpostgres# create table t1(key1 int);
CREATE TABLE
lightdbpostgres# create package t1 ISkey1 real;end;
/
ERROR: relation t1 already exists
HINT: A relation has the same name, so you must use a name that doesnt conflict with any existing relation.
lightdbpostgres# drop table t1;
DROP TABLE
lightdbpostgres# create package t1 ISkey1 real;end;
/
CREATE PACKAGE
lightdbpostgres# create table t1(key1 int);
ERROR: package t1 already exists
HINT: A package has the same name, so you must use a name that doesnt conflict with any existing package.
lightdbpostgres#