24 Star 25 Fork 189

openGauss / Plugin

 / 详情

【测试类型:SQL功能】【测试版本:5.1.0】default值导出后无法导入

已完成
缺陷 成员
创建于  
2023-06-26 11:10

【标题描述】:
【测试类型:SQL功能】【测试版本:5.1.0】default值导出后无法导入

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

【测试环境】(单机/1主x备x级联备):
单机
【被测功能】:
SQL功能
【测试类型】:
default值
【数据库版本】(查询命令: gaussdb -V):
gaussdb (openGauss 5.1.0 build 419bf8c4) compiled at 2023-06-14 11:52:59 commit 0 last mr debug
【预置条件】:
B库+插件
【操作步骤】(请填写详细的操作步骤):

create table t1(a timestamp default pg_systimestamp()::timestamp(0));

导出后再导入

【预期输出】:
导入成功,表结构正常

【实际输出】:
导入失败

可通过show create table查看表结构信息,结果如下:

self_b=# show create table t1;
 Table |                                        Create Table                                        
-------+--------------------------------------------------------------------------------------------
 t1    | SET search_path = public;                                                                 +
       | CREATE TABLE t1 (                                                                         +
       |     a timestamp(0) with time zone DEFAULT (pg_systimestamp())::timestamp(0) with time zone+
       | )                                                                                         +
       | WITH (orientation=row, compression=no);
(1 row)

当前由于支持default() 函数,导致default后面不能跟括号,导出的信息里面有括号,导致导入失败:

self_b=# CREATE TABLE t1 (  a timestamp(0) with time zone DEFAULT (pg_systimestamp())::timestamp(0) with time zone);
ERROR:  syntax error at or near "("
LINE 1: ...TABLE t1 (  a timestamp(0) with time zone DEFAULT (pg_systim...

去掉括号的话则能成功:

self_b=# CREATE TABLE t1 (  a timestamp(0) with time zone DEFAULT pg_systimestamp()::timestamp(0) with time zone);
CREATE TABLE

【原因分析】:

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

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

【测试代码】:

评论 (3)

pengjiong 创建了缺陷

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

opengauss_bot 添加了
 
sig/plugin
标签

Hi @pengjiong,
if you want to get quick review about your issue, please contact the owner in first: @黄凯耀 ,
and then any of the maintainers: @黄凯耀 , @CodeRejector
and then any of the committers: @吴岳川 , @熊小军 , @xiuqiangwang , @zhaojun , @husan1024 , @siven_dev , @chenxiaobin , @jeremytim , @pengjiong , @wumingyuan , @zhaosiqi
if you have any question, please contact the SIG: Plugin.

pengjiong 修改了描述
pengjiong 负责人设置为yuchao
pengjiong 添加协作者pengjiong
pengjiong 优先级设置为不重要
pengjiong 关联项目设置为openGauss 5.1.0 community
pengjiong 计划开始日期设置为2023-06-27
pengjiong 计划截止日期设置为2023-06-29
pengjiong 添加协作者吴岳川
yuchao 计划截止日期2023-06-29 修改为2023-07-07
Will 取消协作者pengjiong
yuchao 任务状态待办的 修改为已确认
yuchao 任务状态已确认 修改为修复中
yuchao 通过opengauss/Plugin Pull Request !925任务状态修复中 修改为已完成

gs_dump工具导出导入验证通过
输入图片说明

输入图片说明

登录 后才可以发表评论

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

搜索帮助