LightDB支持month作为列别名

背景

目前,lightdb 在兼容 oracle,目标是 oracle 用户不用修改 sql 代码无缝切换到 lightdb 数据库。oracle中支持month作为列名(是bare label,而不是as label),例如如下sql可在oracle中正常执行,而原生pg并不能支持,因此在LightDB1.0.V202304.00.000中,支持month作为barelabel类型的列名:

SQL> select 1 month from dual;

     MONTH
----------
         1

SQL> select interval '3' month from dual;

INTERVAL'3'MONTH
-------------------------------------------------------------------------------
+00-03

SQL> select interval '3' month month from dual;

MONTH
-------------------------------------------------------------------------------
+00-03

使用案例

select 1 month;
select 'abc' month;
select to_date('20231117','yyyymmdd') month;
select to_date('20231117','yyyymmdd') - to_date('20231113','yyyymmdd') month;
select interval 3;
select interval '3';
select interval 3 month;
select interval 3 month month;
select interval '3' month;
select interval '3' month month;

CREATE OR REPLACE FORCE EDITIONABLE VIEW VBASE_ORGFINANCEINFO("COMPANY_ID", "MONTH", "LAST_MONTH_NET_VALUE", "LAST_QAUARTER_TOTAL_ASSET") AS
SELECT
9999 company_id,
0 month ,
0 last_month_net_value,
0 last_qauarter_total_asset
FROM
DUAL WHERE 1=2;
drop view VBASE_ORGFINANCEINFO;
select month from (select * from (select * from (select 1 month)));
select month from (select * from (select * from (select 1 month) month));
select month from (select * from (select * from (select 1 month) month) month) month;
select cast(12222 as int) month;
select 1+1  month;
create or replace function func99(a int) return int is
begin
raise notice '666'; return 5; 
end;
/
select func99(1111) as month;
select func99(1111) month;

你可能感兴趣的:(postgresql,oracle)