402 Star 1.4K Fork 1.5K

GVPopenGauss / openGauss-server

 / 详情

unix_timestamp函数指定不同时区——返回值跟mysql不相符

已验收
缺陷
创建于  
2023-09-20 11:52

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

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

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

【被测功能】:unix_timestamp函数指定不同时区

【测试类型】:

【数据库版本】(查询命令: gaussdb -V):输入图片说明

【预置条件】:
mysql验证默认信息为:
输入图片说明
输入图片说明
【操作步骤】(请填写详细的操作步骤):
set timezone=default;
select unix_timestamp('1970-01-01+00');
select unix_timestamp('1970-01-01+08');
select unix_timestamp('1970-01-01 00:00:00');
select unix_timestamp('1970-01-01 08:00:00');
select unix_timestamp('1970-01-01 00:00:00+00:00');
select unix_timestamp('1970-01-01 08:00:00+00:00');
select unix_timestamp('1970-01-01 00:00:00+08:00');
select unix_timestamp('1970-01-01 08:00:00+08:00');

set timezone='+00';
select unix_timestamp('1970-01-01+00');
select unix_timestamp('1970-01-01+08');
select unix_timestamp('1970-01-01 00:00:00');
select unix_timestamp('1970-01-01 08:00:00');
select unix_timestamp('1970-01-01 00:00:00+00:00');
select unix_timestamp('1970-01-01 08:00:00+00:00');
select unix_timestamp('1970-01-01 00:00:00+08:00');
select unix_timestamp('1970-01-01 08:00:00+08:00');

set timezone='+04';
select unix_timestamp('1970-01-01+00');
select unix_timestamp('1970-01-01+08');
select unix_timestamp('1970-01-01 00:00:00');
select unix_timestamp('1970-01-01 08:00:00');
select unix_timestamp('1970-01-01 00:00:00+00:00');
select unix_timestamp('1970-01-01 08:00:00+00:00');
select unix_timestamp('1970-01-01 00:00:00+08:00');
select unix_timestamp('1970-01-01 08:00:00+08:00');

set timezone='+08';
select unix_timestamp('1970-01-01+00');
select unix_timestamp('1970-01-01+08');
select unix_timestamp('1970-01-01 00:00:00');
select unix_timestamp('1970-01-01 08:00:00');
select unix_timestamp('1970-01-01 00:00:00+00:00');
select unix_timestamp('1970-01-01 08:00:00+00:00');
select unix_timestamp('1970-01-01 00:00:00+08:00');
select unix_timestamp('1970-01-01 08:00:00+08:00');

set timezone='-08';
select unix_timestamp('1970-01-01+00');
select unix_timestamp('1970-01-01+08');
select unix_timestamp('1970-01-01 00:00:00');
select unix_timestamp('1970-01-01 08:00:00');
select unix_timestamp('1970-01-01 00:00:00+00:00');
select unix_timestamp('1970-01-01 08:00:00+00:00');
select unix_timestamp('1970-01-01 00:00:00+08:00');
select unix_timestamp('1970-01-01 08:00:00+08:00');

【预期输出】:
default——0,0,0,0,0,0,0,0,0
输入图片说明
+00:00——0,28800,0,28800,0,28800,0,28800
输入图片说明
-08:00——28800,57600,28800,57600,28800,57600,28800,57600
输入图片说明
+08:00——0,0,0,0,0,0,0,0
输入图片说明
+04:00——0,14400,0,14400,0,14400,0,14400
输入图片说明
【实际输出】:
default——14400,43200,14400,43200,14400,43200,14400,43200
输入图片说明
+00:00——0,28800,0,28800,0,28800,0,28800
输入图片说明
-08:00——0,0,0,0,0,0,0,0
输入图片说明
+08:00——28800,57600,28800,57600,28800,57600,28800,57600
输入图片说明
+04:00——14400,43200,14400,43200,14400,43200,14400,43200
输入图片说明
【原因分析】:

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

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

【测试代码】:

评论 (4)

cloudsbreak 创建了缺陷

Hey @cloudsbreak, 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 @cloudsbreak, 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 .

jiexiao1413 负责人设置为吴岳川
吴岳川 添加协作者吴岳川
吴岳川 负责人吴岳川 修改为李秦朗
李秦朗 任务状态待办的 修改为已确认
吴岳川 组织设置为杠开始分析
吴岳川 负责人李秦朗 修改为yuchao
吴岳川 添加协作者李秦朗
yuchao 任务状态已确认 修改为修复中
yuchao 通过opengauss/Plugin Pull Request !1039任务状态修复中 修改为已完成
yuchao 任务状态已完成 修改为待回归
jiexiao1413 任务状态待回归 修改为测试中

已回归
openGauss 5.1.0 build b5a8d5b0
set timezone=default;
输入图片说明
输入图片说明

set timezone='+00';
输入图片说明
输入图片说明

set timezone='+04';
输入图片说明
输入图片说明

set timezone='-08';
输入图片说明
输入图片说明

set timezone='+08';

selectdb=# select unix_timestamp('1970-01-01+00');
select unix_timestamp('1970-01-01 00:00:00');
select unix_timestamp('1970-01-01 08:00:00');
select unix_timestamp('1970-01-01 00:00:00+00:00');
select unix_timestamp('1970-01-01 08:00:00+00:00');
select unix_timestamp('1970-01-01 00:00:00+08:00');
select unix_timestamp('1970-01-01 08:00:00+08:00'); unix_timestamp
----------------
              0
(1 row)

db=# select unix_timestamp('1970-01-01+08');
 unix_timestamp
----------------
              0
(1 row)

db=# select unix_timestamp('1970-01-01 00:00:00');
 unix_timestamp
----------------
              0
(1 row)

db=# select unix_timestamp('1970-01-01 08:00:00');
 unix_timestamp
----------------
              0
(1 row)

db=# select unix_timestamp('1970-01-01 00:00:00+00:00');
 unix_timestamp
----------------
              0
(1 row)

db=# select unix_timestamp('1970-01-01 08:00:00+00:00');
 unix_timestamp
----------------
              0
(1 row)

db=# select unix_timestamp('1970-01-01 00:00:00+08:00');
 unix_timestamp
----------------
              0
(1 row)

db=# select unix_timestamp('1970-01-01 08:00:00+08:00');
 unix_timestamp
----------------
              0
(1 row)

jiexiao1413 任务状态测试中 修改为已验收

gsql ((openGauss 5.0.1 build f766addf) compiled at 2023-10-07 18:07:51 commit 0 last mr )
1.set timezone=default;
输入图片说明
输入图片说明
2.set timezone='+00';
输入图片说明
输入图片说明
3.set timezone='+04';
输入图片说明
输入图片说明
4.set timezone='+08';
输入图片说明
输入图片说明
5.set timezone='-08';
输入图片说明
输入图片说明

登录 后才可以发表评论

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

搜索帮助