Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freesql Oracel 自动分表,当查询的日期在一个月内,但生成的sql 仍然 几个月的 #1099

Closed
sukney opened this issue May 12, 2022 · 4 comments

Comments

@sukney
Copy link

sukney commented May 12, 2022

freesql 3.2.630
Oracel 自动分表,当查询的日期在一个月内,但生成的sql 仍然 是查询几个月的 数据,生成的sql如下
SELECT * from (SELECT t.* FROM (SELECT a."ID" as1, a."CREATED_BY" as2, a."CREATED_BY_NAME" as3, a."CREATED_TIME" as4, a."REAL_NAME" as5, a."IP" as6, a."BROWSER" as7, a."OS" as8, a."DEVICE" as9, a."BROWSERINFO" as10, a."ELAPSED_MILLISECONDS" as11, a."STATUS" as12, a."MESSAGE" as13, a."RESULT" as14
FROM "SYS_L_LOG_202204" a
WHERE (a."CREATED_TIME" between to_timestamp('2022-05-01 00:00:00.000000','YYYY-MM-DD HH24:MI:SS.FF6') and to_timestamp('2022-05-12 21:26:31.639469','YYYY-MM-DD HH24:MI:SS.FF6'))
ORDER BY a."ID" DESC) t WHERE ROWNUM < 21) ftb

UNION ALL

SELECT * from (SELECT t.* FROM (SELECT a."ID" as1, a."CREATED_BY" as2, a."CREATED_BY_NAME" as3, a."CREATED_TIME" as4, a."REAL_NAME" as5, a."IP" as6, a."BROWSER" as7, a."OS" as8, a."DEVICE" as9, a."BROWSERINFO" as10, a."ELAPSED_MILLISECONDS" as11, a."STATUS" as12, a."MESSAGE" as13, a."RESULT" as14
FROM "SYS_L_LOG_202201" a
WHERE (a."CREATED_TIME" between to_timestamp('2022-05-01 00:00:00.000000','YYYY-MM-DD HH24:MI:SS.FF6') and to_timestamp('2022-05-12 21:26:31.639469','YYYY-MM-DD HH24:MI:SS.FF6'))
ORDER BY a."ID" DESC) t WHERE ROWNUM < 21) ftb

我的代码
image

@sukney
Copy link
Author

sukney commented May 12, 2022

实体 注解 [Table(Name = "sys_l_log_{yyyyMM}", AsTable = "CreatedTime=2022-1-1(3 month)")]

@sukney
Copy link
Author

sukney commented May 12, 2022

同样的代码pgsql是正常的,生成的只有一条语句
SELECT a."ID" as1, a."CREATED_BY" as2, a."CREATED_BY_NAME" as3, a."CREATED_TIME" as4, a."REAL_NAME" as5, a."IP" as6, a."BROWSER" as7, a."OS" as8, a."DEVICE" as9, a."BROWSERINFO" as10, a."ELAPSED_MILLISECONDS" as11, a."STATUS" as12, a."MESSAGE" as13, a."RESULT" as14
FROM "sys_login_log_202204" a
WHERE (a."CREATED_TIME" between '2022-05-01 00:00:00.000000' and '2022-05-12 21:40:45.573591')
ORDER BY a."ID" DESC
limit 20

@2881099
Copy link
Collaborator

2881099 commented May 12, 2022

收到,等会发布新版本

2881099 added a commit that referenced this issue May 12, 2022
@2881099
Copy link
Collaborator

2881099 commented May 12, 2022

v3.2.631

2881099 added a commit that referenced this issue May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants