402 Star 1.4K Fork 1.5K

GVPopenGauss / openGauss-server

 / 详情

jdbc中current_date函数返回结果错误

待办的
缺陷
创建于  
2023-08-24 11:09

【标题描述】:
【测试类型:SQL功能/存储功能/接口功能/工具功能/性能/并发/压力长稳/故障注入/安全/资料/编码规范】【测试版本:5.1.0】 问题描述

【操作系统和硬件信息】(查询命令: cat /etc/system-release, uname -a):

【测试环境】(单机/1主x备x级联备):

【被测功能】:

【测试类型】:

【数据库版本】(查询命令: gaussdb -V):

【预置条件】:

【操作步骤】(请填写详细的操作步骤):
此问题场景为cached plan+current_date函数,jdbc/PBE复现方法类似,prepare后重复执行查询且日期变化即可复现。
-- prepare && cached
SET plan_cache_mode='force_generic_plan';
PREPARE s1 AS SELECT current_date;
-- 修改日期后再次执行s1应当返回正确日期
! sudo date -s xxxx
EXECUTE s1;
-- explain
EXPLAIN VERBOSE SELECT current_date;

【预期输出】:
查询返回正确结果。
explain中current_date不为常量

MogDB=# explain verbose select current_date;
QUERY PLAN
------------------------------------------+
Result (cost=0.00..0.01 rows=1 width=0)
Output: text_date('now'::text)
(2 rows)
【实际输出】:
日期返回错误,explain中current_date为常量。
【原因分析】:

  1. 这个问题的根因
  2. 问题推断过程
  3. 还有哪些原因可能造成类似现象
  4. 该问题是否有临时规避措施
  5. 问题解决方案
  6. 预计修复问题时间

【日志信息】(请附上日志文件、截图、coredump信息):

【测试代码】:

评论 (5)

cuikaifeng 创建了缺陷

Hey @cuikaifeng, Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss_bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at Here to find the details.

Hi @cuikaifeng, please use the command /sig xxx to add a SIG label to this issue.
For example: /sig sqlengine or /sig storageengine or /sig om or /sig ai and so on.
You can find more SIG labels from Here.
If you have no idea about that, please contact with @xiangxinyong , @zhangxubo .

麻烦把这个issue分配给我,谢谢。 @xiangxinyong @zhangxubo

jiexiao1413 负责人设置为cuikaifeng
cuikaifeng 修改了描述
cuikaifeng 修改了描述
cuikaifeng 修改了描述
王恬静 优先级设置为次要

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
13084139 opengauss bot 1686829535
C++
1
https://gitee.com/opengauss/openGauss-server.git
git@gitee.com:opengauss/openGauss-server.git
opengauss
openGauss-server
openGauss-server

搜索帮助