Compare commits

...

638 Commits
glt ... master

Author SHA1 Message Date
xxq250 dde14c622e 高校绿色计算大赛预赛第一阶段(openGauss) 2023-03-09 14:35:04 +08:00
xxq250 93a1b93f40 openGauss-触发器 2023-03-08 17:01:57 +08:00
xxq250 3246399eba openGauss-并发控制与事务的隔离级别 2023-03-08 17:01:24 +08:00
xxq250 793e2ebf1a openGauss-基本操作 2023-03-08 17:00:52 +08:00
xxq250 7d9bb66972 openGauss-存储过程与事务 2023-03-08 17:00:15 +08:00
xxq250 8b83bcdd2c openGauss-安全性控制 2023-03-08 16:59:39 +08:00
xxq250 727e6ea941 openGauss-数据查询(Select) 2023-03-08 16:59:06 +08:00
xxq250 591e19db8d openGauss-用户自定义函数 2023-03-08 16:58:37 +08:00
opengauss-bot cee4f486b3
!3048 修复gs_basebackup用默认xlog传输方式 -X 参数提示密码错误
Merge pull request !3048 from 仲夏十三/mas9
2023-03-08 07:18:57 +00:00
opengauss-bot a94a50e30d
!3043 解决docker重新拉起失败的问题
Merge pull request !3043 from zhangxubo/master
2023-03-08 06:46:01 +00:00
opengauss-bot d639b6b943
!3021 合入PR: Bitmap Index Scan optimization,使用宏和模板重构bitmap使用的hashtable
Merge pull request !3021 from yyl/3-3bitmmap
2023-03-08 01:43:47 +00:00
opengauss-bot 9e748bc12d
!3040 社区dss/dms commit点更新
Merge pull request !3040 from 陈志凯/master
2023-03-08 01:06:21 +00:00
opengauss-bot 918d319bd1
!3029 【共享存储】1. 修复ckpt->doublewrite和switchover并发场景, 节点crash 2. 修复DSS切主失败导致DB panic core
Merge pull request !3029 from 刘博文/1dev
2023-03-07 14:20:37 +00:00
opengauss-bot 2468767828
!3047 【共享存储】解决部分场景下备机未能跳过回放的问题
Merge pull request !3047 from 陈栋/bugfix
2023-03-07 14:19:34 +00:00
chendong76 5dde94aeb4 解决部分场景下备机未能跳过回放的问题 2023-03-07 21:37:10 +08:00
ganyang 73f7d2f9b1 clear password later for LogStreamer 2023-03-07 21:17:06 +08:00
opengauss-bot 34830d852d
!3039 修复uniqueSQL对hash算子统计信息不准的问题
Merge pull request !3039 from 胡正超/hash
2023-03-07 12:58:10 +00:00
opengauss-bot b8ee37ad67
!3037 避免重启db后备机将二阶段文件删除
Merge pull request !3037 from 陈超/1.0.0
2023-03-07 11:47:17 +00:00
bowenliu ca5adff1b6 set DSS primary failed, simply exit and re-join 2023-03-07 19:35:28 +08:00
chenzhikai 8148d0a19d 社区dss dms commit点更新 3/7 2023-03-07 19:15:58 +08:00
chenchao efae2abdc9 避免重启db后备机将二阶段文件删除 2023-03-07 17:28:46 +08:00
opengauss-bot 85748e3c12
!3032 添加odbc依赖添加到包中,并添加dblink基于odbc连接失败时错误的详情信息
Merge pull request !3032 from 陈志凯/master
2023-03-07 09:12:25 +00:00
zhang_xubo 00eaec99a3 docker重新拉起失败 2023-03-07 17:01:36 +08:00
opengauss-bot cb4bb56d8d
!2894 同时指定no-locale和locale参数时,gs_initdb出现coredump
Merge pull request !2894 from zhang_jintao2020/gs_initdb
2023-03-07 07:28:42 +00:00
opengauss-bot 946165b8cb
!3030 放开plpython自定义语言支持
Merge pull request !3030 from zhangxubo/master-pl
2023-03-07 07:24:27 +00:00
gentle_hu 432cc6d43a 修复unique sql对于hash算子统计信息不准的问题 2023-03-07 10:29:45 +08:00
chenzhikai dd853ba943 添加odbc依赖到包中,并增加dblink连接失败报错的详情信息 2023-03-07 09:55:49 +08:00
opengauss-bot 37de345c9c
!3027 【共享存储】在页面淘汰过程中,遇到DMS特定的待刷盘的页面,选择刷下去,避免无buffer可用
Merge pull request !3027 from 董宁/dn_fix9_up
2023-03-07 01:41:55 +00:00
opengauss-bot 1443f58545
!3036 修改创建ASTORE表时指定INIT_TD参数未报错的pr的自测用例
Merge pull request !3036 from Ruixiang Li/master
2023-03-07 01:32:44 +00:00
opengauss-bot 3cf655f35f
!3026 【共享存储】失效页面回调发现无效buffer时,向上层返回错误,由上层重试
Merge pull request !3026 from 刘博文/2dev
2023-03-06 13:21:54 +00:00
liruixiang b1e88debe4 修改创建ASTORE表时指定INIT_TD参数未报错的pr的自测用例 2023-03-06 20:17:13 +08:00
dongning12 227264f32a 【共享存储】flush buffer if need, which has need flush tag 2023-03-06 19:47:57 +08:00
opengauss-bot f358576f8b
!3003 修复创建ASTORE表时指定INIT_TD参数未报错的问题
Merge pull request !3003 from Ruixiang Li/master
2023-03-06 09:36:39 +00:00
opengauss-bot 4b47cabb2b
!3025 规避并行make导致的file truncate问题
Merge pull request !3025 from pengjiong/fix_date
2023-03-06 09:32:08 +00:00
wuchenglin 58e6120553 !2998 SRF执行优化
* fix srf factcheck case
* SRF执行优化
2023-03-06 09:29:04 +00:00
liruixiang 7a66efc41b 修复创建ASTORE表时指定INIT_TD参数未报错 2023-03-06 16:33:27 +08:00
bowenliu bf4e1d616d change assert to return error for invalidate page 2023-03-06 16:29:39 +08:00
opengauss-bot dcdd67aad7
!2898 解决防篡改分区表insert时,全局索引tableoid为0的问题。
Merge pull request !2898 from playrest/master-ledger
2023-03-06 08:26:20 +00:00
totaj 5b6c28fe84 Workaround: fix file truncated. 2023-03-06 14:53:52 +08:00
opengauss-bot c47f5a09d4
!3006 undo launcher线程结束时释放共享内存中的latch
Merge pull request !3006 from CCA/fixbug_undo_launcher
2023-03-06 06:21:56 +00:00
zhang_xubo 7b3c0feadd support plpython language 2023-03-04 18:51:00 +08:00
opengauss-bot 16f8644c9b
!3024 增加dolphin hook plpgsql_parser_setup
Merge pull request !3024 from chenbd/hook_plpg
2023-03-04 06:49:56 +00:00
yyl164119487 93b27dc49f 合入PR: Bitmap Index Scan optimization,使用宏和模板重构bitmap使用的hashtable 2023-03-04 14:24:13 +08:00
opengauss-bot af36f2ac52
!3022 修复libpq模块parser的文件引用问题
Merge pull request !3022 from fugang/parser_opt
2023-03-04 02:16:22 +00:00
chenbd 409e828445 增加dolphin hook plpgsql_parser_setup 2023-03-03 11:39:34 -05:00
fugang fc26506099 fix libpq parser and makefile 2023-03-03 19:07:32 +08:00
opengauss-bot eb020174a8
!3011 修复pbe场景下explain plan的core问题
Merge pull request !3011 from 仲夏十三/mas9
2023-03-03 09:21:52 +00:00
opengauss-bot 4b8cfc0f1a
!3016 修复自定义单目运算符在nodeToString阶段报错的bug
Merge pull request !3016 from Cross-罗/fix-rewrite-bug
2023-03-03 03:19:52 +00:00
ganyang 66a0e4f347 fix explain plan pbe core 2023-03-03 11:19:50 +08:00
opengauss-bot 40c11d8fa8
!2915 实现事件触发器
Merge pull request !2915 from kenxx/ken_eventtrigger_submit
2023-03-03 00:41:38 +00:00
kenxx 9f8064bb24 实现事件触发器 2023-03-02 11:09:39 -05:00
opengauss-bot 5a69c46920
!3017 dss dms commit点更新
Merge pull request !3017 from zhaobingyu/master
2023-03-02 12:19:52 +00:00
opengauss-bot 195e9d58c3
!2983 Numeric优化
Merge pull request !2983 from fugang/numeric2
2023-03-02 11:29:10 +00:00
opengauss-bot cd12ea624e
!3010 Parser优化
Merge pull request !3010 from fugang/parser_opt
2023-03-02 11:29:04 +00:00
opengauss-bot b8538ddcfb
!2952 修改syscache,catcache 的访问方式,可以接受hook
Merge pull request !2952 from chenbd/hook_cache
2023-03-02 11:13:32 +00:00
zhaobingyu d0b095c505 dss dms commit点更新 2023-03-02 18:51:36 +08:00
luozihao 4e461e3ffb 修复自定义单目运算符在rewrite阶段报错的bug 2023-03-02 17:18:35 +08:00
opengauss-bot 672a03e1c5
!3005 修复不稳定用例alter_table_modify [ _ustore ]
Merge pull request !3005 from 胡正超/fsck
2023-03-02 08:42:17 +00:00
fugang 449de3d407 parser opt 2023-03-02 15:24:16 +08:00
opengauss-bot d4c6baf3f2
!2987 对agg numeric类型sum、agg等函数优化
Merge pull request !2987 from cailei/numeric_0227
2023-03-02 06:38:21 +00:00
opengauss-bot 022391dab6
!3004 修复dblink的make install位置放置错误问题
Merge pull request !3004 from 陈志凯/master
2023-03-02 06:22:52 +00:00
opengauss-bot 2f380bcdb0
!3009 dss dms commit点更新
Merge pull request !3009 from zhaobingyu/master
2023-03-02 03:34:13 +00:00
opengauss-bot 4a4cae7bf8
!3002 jsonb中展示小数的前缀0
Merge pull request !3002 from 胡正超/jsonbnumeric
2023-03-02 02:43:02 +00:00
opengauss-bot a54c0c8f4b
!2800 B模式语法兼容- declare handler
Merge pull request !2800 from 暖阳/declare_handler
2023-03-02 01:59:23 +00:00
opengauss-bot 597f69d7a4
!2872 优化hashjoin的hash策略
Merge pull request !2872 from wanghao19920907/PR_2296_new
2023-03-02 01:52:58 +00:00
opengauss-bot 20b5a1f9f4
!2934 MySQL兼容-create table as
Merge pull request !2934 from qx21/master_createas
2023-03-02 01:45:10 +00:00
wanghao19920907 d95ff6d974 优化hashjoin的hash策略 2023-03-01 04:14:32 -08:00
zhaobingyu 4352632534 dss dms commit点更新 2023-03-01 19:22:55 +08:00
cailei19 4180f34b3d agg优化 numeric相关sum\avg等优化 2023-03-01 17:54:52 +08:00
opengauss-bot 8c9b36a9d8
!2648 M* 语法兼容 select @var := 2 语法
Merge pull request !2648 from chenbd/uservar_req
2023-03-01 08:40:45 +00:00
cca5507 8cd82a12c5 fix undo launcher's bug 2023-03-01 16:27:44 +08:00
gentle_hu e134f38892 Jsonb should always display leading zero 2023-03-01 16:27:09 +08:00
gentle_hu f7a4a90e93 修复不稳定并发fastcheck用例
并发alter_table_modify alter_table_modify_ustore 用例中, 使用了同样的用户名,当两个用例的这部分同时执行时,会导致错误
2023-03-01 15:05:34 +08:00
nnuanyang 575169c0e6 b_format 2023-02-28 21:49:14 -08:00
nnuanyang 55fb931a8e declare exit handler for condition_value 2023-02-28 21:49:14 -08:00
cbd123cbd b37d669f16 M* 语法兼容 select @var := 2 语法 2023-02-28 22:42:30 -05:00
opengauss-bot 9ca77f6327
!2996 AGG投影和转移函数优化
Merge pull request !2996 from 夏自豪/agg_v1
2023-03-01 03:03:41 +00:00
opengauss-bot 633add65a5
!3000 add upgrade check in pr template
Merge pull request !3000 from zhengxue/master_pr
2023-03-01 03:02:43 +00:00
chenzhikai ed24b4dd2a dblink安装 2023-03-01 10:45:01 +08:00
opengauss-bot cb69338a83
!2557 M* 兼容 force/use index 语法
Merge pull request !2557 from chenbd/master
2023-03-01 01:56:16 +00:00
opengauss-bot 73d540c750
!2978 Inner Unique optimazation
Merge pull request !2978 from hyperstol/master_iu_2
2023-02-28 14:48:45 +00:00
opengauss-bot 36b42f0507
!2947 dblink支持通过odbc连接异构数据库
Merge pull request !2947 from 陈志凯/master
2023-02-28 14:20:58 +00:00
opengauss-bot baedc3ab1e
!2939 支持以user@host进行认证鉴权
Merge pull request !2939 from 王修强/auth_og
2023-02-28 14:14:01 +00:00
shirley_zhengx 60b367a940 add upgrade check in pr template 2023-02-28 22:01:35 +08:00
lizhen 9e57ff3e8e Inner Unique 2023-02-28 05:11:41 -08:00
chenzhikai 2815152fe1 dblink支持通过odbc连接异构数据库 2023-02-28 21:03:23 +08:00
opengauss-bot 70f464b44d
!2986 索引扫描算子优化
Merge pull request !2986 from yyl/base-index
2023-02-28 12:12:18 +00:00
opengauss-bot 6bbae768f1
!2966 扩大备份日志数量
Merge pull request !2966 from jihanyu/master
2023-02-28 12:05:07 +00:00
夏自豪 1b8ab5a2e2 减少nodeagg算子初始化转移函数的次数,减少算子nodeagg的投影次数
Signed-off-by: 夏自豪 <xiazihao3@huawei.com>
2023-02-28 03:17:51 -08:00
opengauss-bot cae89236d1
!2963 修复多表操作时有子查询报错的问题
Merge pull request !2963 from 吴禹均/master
2023-02-28 10:59:27 +00:00
zhengshaoyu 41078c951a !2979 Seqscan底噪消除-单表查询无索引性能优化
* Seqscan性能优化
* Seqscan性能优化
* Seqscan性能优化
* SeqScan性能优化
2023-02-28 09:34:49 +00:00
WangXiuqiang 62d9aa7012 角色验证和鉴权 2023-02-28 17:15:34 +08:00
opengauss-bot 34f759c327
!2950 支持兼容lock tables语法和功能
Merge pull request !2950 from 王修强/lock_table
2023-02-28 09:01:31 +00:00
opengauss-bot d0626058b8
!2992 【共享存储】锁模式为NULL的情况下也需要转移页面
Merge pull request !2992 from 董宁/dn_fix8
2023-02-28 08:17:43 +00:00
opengauss-bot 0ffb3f47a0
!2960 TPCH查询重写优化,子连接提升
Merge pull request !2960 from haruworms/slk
2023-02-28 08:14:51 +00:00
opengauss-bot 5f7ad14378
!2376 hashjoin细节优化
Merge pull request !2376 from wanghao19920907/PR_2299
2023-02-28 08:11:14 +00:00
playrest bb7cffcc3b 解决防篡改分区表insert时,全局索引tableoid为0的问题。 2023-02-28 14:13:55 +08:00
chenbd 728bb6933b 修改syscache,catcache 的访问方式,可以接受hook 2023-02-28 00:06:34 -05:00
jihanyu fc7032535f 扩大备份日志数量 2023-02-28 10:47:06 +08:00
yyl164119487 0126ddc59d 索引扫描算子优化 2023-02-27 18:33:17 -08:00
dongning12 3541b757bd 【共享存储】在锁模式为null的情况下,依旧转移页面 2023-02-28 10:12:01 +08:00
cbd123cbd 9363717384 M* 兼容 force/use index 语法 2023-02-27 08:37:27 -05:00
opengauss-bot 3fee79a080
!2971 【共享存储】适配极致RTO
Merge pull request !2971 from 陈栋/rto
2023-02-27 12:57:41 +00:00
h00502768 ad1a3b25d7 subquery optimization in TPCH 2023-02-27 04:05:03 -08:00
opengauss-bot 1f6090e30e
!2977 同步5.0.0版本特性
Merge pull request !2977 from 杨皓/master
2023-02-27 11:02:01 +00:00
openGaussDev f7d23913d6 sync all inner code 2023-02-27 14:08:20 +08:00
opengauss-bot 7d1c911b5c
!2784 函数WLMAdjustCGroup4EachThreadOnDN内比较不准确
Merge pull request !2784 from foolishlee/WLMAdjustCGroup4EachThreadOnDN
2023-02-27 03:20:32 +00:00
opengauss-bot 2273500060
!2974 通信优化
Merge pull request !2974 from 刘宝珠/comm
2023-02-27 02:51:25 +00:00
opengauss-bot a7eacafade
!2965 xml增加小型化控制
Merge pull request !2965 from 刘恒/master
2023-02-27 02:48:08 +00:00
chendong76 6bb6c98613 【共享存储】适配极致RTO,更新dms commit点 2023-02-27 10:21:28 +08:00
liubaozhu 26e959b405 通信优化 2023-02-25 06:37:44 -08:00
fugang add392eb9a numeric optimization 2023-02-25 06:03:46 -08:00
liuheng 6db88b785b xml增加小型化控制 2023-02-25 18:32:29 +08:00
opengauss-bot a10741b11e
!2969 优化printtup执行效率
Merge pull request !2969 from 刘宝珠/printtup
2023-02-25 09:36:42 +00:00
liubaozhu 210b3aa814 优化printtup执行效率,去除不需要的逻辑 2023-02-25 00:29:36 -08:00
opengauss-bot 2f59d8c81c
!2895 gsql 客户端\timing 计时开关打开后,显示时间错误
Merge pull request !2895 from zhang_jintao2020/timing2
2023-02-25 07:34:31 +00:00
opengauss-bot 2114241085
!2959 [共享存储]修改issue--共享存储模式gs_probackup备份完毕立即cm_ctl stop,数据库重启产生core
Merge pull request !2959 from zhaobingyu/master
2023-02-25 02:01:36 +00:00
opengauss-bot a2baa2d934
!2964 发布订阅自测用例增加database兼容性参数
Merge pull request !2964 from chenxiaobin/addCompatibility
2023-02-25 01:37:46 +00:00
qianxue21 404cd52cd1 MySQL兼容-create table as 2023-02-25 00:41:27 +08:00
opengauss-bot 8e20244935
!2957 修复alter table set schema可修改为系统内部模式的问题
Merge pull request !2957 from Ruixiang Li/master
2023-02-24 12:01:58 +00:00
chenxiaobin19 5b5e66910b 发布订阅自测用例增加database兼容性参数 2023-02-24 19:37:14 +08:00
suncan 0562c038b8 修复多表操作时有子查询报错的问题 2023-02-24 17:32:56 +08:00
liruixiang a349da1ca3 修复alter table set schema可修改为系统内部模式的问题 2023-02-24 17:31:43 +08:00
zhaobingyu ab40a11cd1 修改issue--共享存储模式gs_probackup备份完毕立即cm_ctl stop,数据库重启产生core 2023-02-24 15:09:33 +08:00
opengauss-bot 3d61862de9
!2958 修复explain时hashtable为空的问题
Merge pull request !2958 from wanghao19920907/fixbug_PR_2297
2023-02-24 06:37:57 +00:00
wanghao19920907 3bc9cc5f7d 修复explain时hashtable为空的问题 2023-02-23 21:55:06 -08:00
opengauss-bot baf70db8f4
!2766 函数gs_r_release_comm_memory内变量cmailbox->buff_q->u_size判断不准确
Merge pull request !2766 from foolishlee/gs_r_release_comm_memory
2023-02-24 02:56:43 +00:00
opengauss-bot 157d1f141e
!2778 函数IsQidInvalid内条件判断不准确
Merge pull request !2778 from foolishlee/IsQidInvalid
2023-02-24 02:50:34 +00:00
wanghao19920907 cbd9538757 优化hashjoin细节、对位操作等做一些指令级优化 2023-02-23 17:59:05 -08:00
opengauss-bot b590711499
!2942 修复OpenGauss CREATE INDEX不支持IF NOT EXISTS语法的问题
Merge pull request !2942 from yuchao/master
2023-02-24 01:47:55 +00:00
opengauss-bot d1b7965c06
!2380 提升external sort性能
Merge pull request !2380 from cc_db_dev/main_external_sort
2023-02-24 01:38:00 +00:00
opengauss-bot 0853225018
!2379 提升numeric除法性能
Merge pull request !2379 from cc_db_dev/main_numeric_div
2023-02-24 01:37:37 +00:00
opengauss-bot c4187161ec
!2954 修复dms event视图查询bug
Merge pull request !2954 from 叶佳才/master
2023-02-23 12:16:13 +00:00
cc_db_dev c85182e24c 提升external sort性能 2023-02-23 19:50:17 +08:00
yuchao 44135e2340 修复OpenGauss CREATE INDEX不支持IF NOT EXISTS语法的问题 2023-02-23 19:22:57 +08:00
opengauss-bot d326c9ef54
!2378 修改bufferdesc大小,提升性能
Merge pull request !2378 from cc_db_dev/main_bufferdesc
2023-02-23 11:15:38 +00:00
opengauss-bot f041cf508e
!2822 TupleTableSlots, tupleDesc, Relation数据结构及相关函数调用优化
Merge pull request !2822 from wanghao19920907/PR_2150_new
2023-02-23 11:14:49 +00:00
WangXiuqiang a71786ee1c 支持lock tables部分功能(server侧) 2023-02-23 17:17:25 +08:00
yejiacai 1b885087e7 fix dms event bug 2023-02-23 16:52:08 +08:00
opengauss-bot d11f5b12ac
!2870 修复plpgsql空数组core问题
Merge pull request !2870 from 仲夏十三/mas9
2023-02-23 03:33:40 +00:00
opengauss-bot f00f5e10f8
!2936 【共享存储】1. 梳理并发场景:Reform与获取各类事务状态并发;2. 优化Reform状态机,减少宏命名歧义,Switchover时dms role在DB与DMS侧同步切换
Merge pull request !2936 from 刘博文/2dev
2023-02-23 03:00:45 +00:00
opengauss-bot dee734479a
!2951 【共享存储】 load_relcache_init_file、write_relcache_init_file函数拦截
Merge pull request !2951 from 陈婷婷/master
2023-02-23 01:58:59 +00:00
opengauss-bot 49eae2eb2c
!2940 修复explain后导致匿名块无法调用存储过程的bug
Merge pull request !2940 from Cross-罗/explain_bugfix
2023-02-23 01:56:36 +00:00
bowenliu e62c1b5080 dms reform state machine; 2023-02-23 09:52:26 +08:00
luozihao 548a2950a6 explain bugfix 2023-02-22 21:42:36 +08:00
opengauss-bot 8ecf040d21
!2920 修复发布订阅场景下删除订阅失败的问题
Merge pull request !2920 from chenxiaobin/addWait
2023-02-22 11:38:08 +00:00
opengauss-bot 7012d53d76
!2937 解决eg_init_bitmap_page_content函数里面判断条件永远为真
Merge pull request !2937 from tangxiao/master
2023-02-22 11:34:23 +00:00
chentingting 96a8d00342 load_relcache_init_file、write_relcache_init_file函数拦截 2023-02-22 18:31:29 +08:00
chenxiaobin19 adbb73b632 Add a WAIT option to DROP_REPLICATION_SLOT 2023-02-22 17:41:14 +08:00
opengauss-bot 7db0daa08d
!2946 【共享存储】释放bufTable的partition锁
Merge pull request !2946 from 董宁/dn_fix7
2023-02-22 07:05:29 +00:00
ganyang 45c965e4f0 forbid treating () as [] array in B and PG 2023-02-22 14:38:09 +08:00
wanghao19920907 911ea39bea Relation数据结构及相关函数调用优化 2023-02-21 20:31:34 -08:00
wanghao19920907 9f84893535 tupleDesc数据结构及相关函数调用优化 2023-02-21 20:30:35 -08:00
wanghao19920907 fd1f338af5 TupleTableSlots数据结构及相关函数调用优化 2023-02-21 20:29:34 -08:00
opengauss-bot c3e3237fe0
!2917 【共享存储】增加页面可访问性拦截
Merge pull request !2917 from 董宁/dn_fix6_up
2023-02-22 03:26:13 +00:00
opengauss-bot d5922c6a7e
!2926 添加create table partition帮助中支持distribute功能的约束
Merge pull request !2926 from yuchao/master
2023-02-22 03:09:35 +00:00
opengauss-bot ddccb0aea5
!2945 添加dms event视图
Merge pull request !2945 from 叶佳才/master
2023-02-22 02:36:30 +00:00
yejiacai a7e70728e4 add dms event 2023-02-22 10:20:26 +08:00
opengauss-bot 04aba45854
!2933 修复当为带有表达式分区键得分区表添加主键时报错的问题
Merge pull request !2933 from 王修强/og_master_bug
2023-02-22 01:40:46 +00:00
opengauss-bot 5761b22869
!2838 解决在synchronous_standby_names='*'时gs_probackup备份失败的问题
Merge pull request !2838 from Movead/prgbackup_feedback_lsn
2023-02-21 15:35:00 +00:00
opengauss-bot f854dfb0c5
!2943 放开二阶段事务限制
Merge pull request !2943 from 陈超/master
2023-02-21 14:54:29 +00:00
opengauss-bot a1c285af1d
!2918 opengauss支持xml
Merge pull request !2918 from 刘恒/master
2023-02-21 14:39:14 +00:00
dongning12 a163a0aa81 【共享存储】释放bufTable的partition锁 2023-02-21 21:11:12 +08:00
opengauss-bot 7aa62090e7
!2944 dss dms commit点更新
Merge pull request !2944 from zhaobingyu/gauss_pkg
2023-02-21 12:54:45 +00:00
opengauss-bot 1c0426da86
!2922 issue修复-操作符优先级问题导致特定表达式语法解析失败问题修复:NOT BETWEEN/LIKE/ILIKE/SIMILAR修复
Merge pull request !2922 from zhangzhixian/operator_precedency_revise
2023-02-21 09:57:48 +00:00
liuheng b40c3ffd7f 支持XML类型 2023-02-21 17:54:21 +08:00
zhaobingyu 2b6bc9e490 dss dms commit点更新 2023-02-21 17:46:09 +08:00
opengauss-bot 017d7dc0a5
!2821 修复:存储过程selet into 变量报错
Merge pull request !2821 from chenbd/fix_delim_bug
2023-02-21 09:30:06 +00:00
opengauss-bot 4ce106922c
!2375 合并pg优化,必要时增加hashjoin的bucket数量
Merge pull request !2375 from wanghao19920907/PR_2297
2023-02-21 08:38:55 +00:00
opengauss-bot 913c0e2fd3
!2374 修复init_var_from_num中性能瓶颈
Merge pull request !2374 from wanghao19920907/PR_2295
2023-02-21 08:38:21 +00:00
opengauss-bot d1c46bb20f
!2363 执行器优化
Merge pull request !2363 from wanghao19920907/PR_2101
2023-02-21 08:38:07 +00:00
opengauss-bot e08956f596
!2354 合并pg pr:集中逻辑保护复制的效用语句
Merge pull request !2354 from ab2020c/master_utility
2023-02-21 08:37:29 +00:00
opengauss-bot 2314f1c9cf
!2668 declare condition 缺陷
Merge pull request !2668 from 暖阳/fix_bug
2023-02-21 07:47:10 +00:00
chenchao d9f1f30ae0 [共享存储]放开二阶段事务 2023-02-21 14:25:48 +08:00
opengauss-bot b768b63576
!2928 1 load_relcache_init_file/write_relcache_init_file 使用512对齐的缓存读写,规避对接DSS后无法非512读写
Merge pull request !2928 from 陈超/master
2023-02-21 06:20:19 +00:00
chenchao 67dd64aa1b [共享存储]load_relcache_init_file/write_relcache_init_file 使用512对齐的缓存读写,规避对接DSS后无法非512读写 2023-02-21 11:12:36 +08:00
nnuanyang e6e765493e condition value
fix_bug
2023-02-20 17:55:02 -08:00
opengauss-bot ec4c0de649
!2941 空格问题导致门禁失败
Merge pull request !2941 from buter/master
2023-02-21 01:39:30 +00:00
buter 5988b0d1dc 修复空格问题 2023-02-20 22:01:02 +08:00
cc_db_dev e88cef70c1 修改bufferdesc大小,提升性能 2023-02-20 17:42:04 +08:00
opengauss-bot c8bd22a470
!2919 新增极简版和轻量版的区分标识
Merge pull request !2919 from buter/master
2023-02-20 09:07:49 +00:00
opengauss-bot 9929f73f0c
!2930 推进dms/dss日志压缩的commit点
Merge pull request !2930 from jihanyu/master
2023-02-20 09:02:24 +00:00
xiaodong.tang c47ffdc137 修复eg_init_bitmap_page_content函数中判断条件永远为真的问题 2023-02-20 16:02:19 +08:00
WangXiuqiang 707b72e2ce 修复当为带有表达式分区键得分区表添加主键时报错的问题 2023-02-20 14:47:42 +08:00
opengauss-bot f427d6a2ee
!2901 禁止防篡改表的索引引用hash字段
Merge pull request !2901 from playrest/master-ledger-index
2023-02-20 03:04:20 +00:00
jihanyu 58f804b16d 推进dms/dss日志压缩的commit点 2023-02-20 10:16:28 +08:00
cbd123cbd c0be30e0e3 修复:存储过程selet into 变量报错 2023-02-19 11:04:16 -05:00
yuchao 6d2b1fbdb0 添加create table partition帮助中支持distribute功能的约束 2023-02-18 18:00:37 +08:00
dongning12 2c54c67394 [共享存储]增加页面可访问性拦截,1避免业务线程获取到中间版本页面 2)避免大量无效请求 2023-02-18 17:30:27 +08:00
opengauss-bot ba442ff864
!2921 【bugfixed】解决参数max_processes=200000+开启线程池,启动数据库coredump 的问题
Merge pull request !2921 from laishenghao/connections-core
2023-02-18 06:52:46 +00:00
opengauss-bot 8e894cc3f1
!2279 修复label名截断问题
Merge pull request !2279 from qx21/feature/labelbug
2023-02-18 06:26:35 +00:00
opengauss-bot 7e7564950a
!2731 解决update部分列无法选择正确分区的问题
Merge pull request !2731 from 王修强/partition_key_update
2023-02-18 06:21:52 +00:00
teooooozhang c15d34220b 操作符优先级修复:NOT BETWEEN/LIKE/ILIKE/SIMILAR 2023-02-18 11:20:01 +08:00
opengauss-bot 688db7b48b
!2681 错误信息缺陷修改
Merge pull request !2681 from 暖阳/fix_bug2
2023-02-18 02:03:30 +00:00
laishenghao c9baf1bd5b 解决参数max_processes=200000+开启线程池,启动数据库coredump 的问题 2023-02-18 09:48:58 +08:00
opengauss-bot f7453c1b8d
!2711 create trigger 语法兼容dump缺陷
Merge pull request !2711 from 暖阳/fix_bug1
2023-02-17 12:36:18 +00:00
opengauss-bot a3ce762af9
!2905 修复配置jdbc驱动参数preferQueryMode为不同参数值,yat执行用例结果不一样的问题
Merge pull request !2905 from yuchao/master
2023-02-17 12:28:32 +00:00
nnuanyang d7420c2caf create trigger dump error
trigger function body is null

upgrade version

definer user name quote identifier

upgrade version2

format
2023-02-17 02:24:41 -08:00
opengauss-bot b597501595
!2868 补充发布订阅用例 && 修复若干问题
Merge pull request !2868 from chenxiaobin/pubsubTestCase
2023-02-17 09:56:31 +00:00
buter b7c6ae6ac0 新增极简版和轻量版的区分标识 2023-02-17 17:18:21 +08:00
opengauss-bot 0387492fed
!2908 [共享存储]修复备机起WLM线程后存在xlog写问题和reform过程中在2次LockBuffer中卡住的问题
Merge pull request !2908 from cchen676/1207master
2023-02-17 06:31:31 +00:00
opengauss-bot 5fa81bb4ec
!2888 issue修复:操作符优先级问题导致特定表达式语法解析失败问题修复
Merge pull request !2888 from zhangzhixian/master
2023-02-17 03:22:41 +00:00
opengauss-bot c59b22d73f
!2902 【bugfixed】解决net、range、hash等类型ignore_error不生效的问题
Merge pull request !2902 from laishenghao/ignore
2023-02-17 02:47:59 +00:00
opengauss-bot 3a995f97e6
!2891 修复SWCB在空格场景下的core问题
Merge pull request !2891 from pengjiong/fix_date
2023-02-17 02:14:05 +00:00
arcoalien@qq.com 76d2924502 修复备机起WLM线程后存在xlog写问题和reform过程中在2次LockBuffer中卡住的问题 2023-02-16 21:50:07 +08:00
laishenghao 72318f22ba 解决net、range、hash等类型ignore_error不生效的问题 2023-02-16 17:44:25 +08:00
opengauss-bot ca299a3b9b
!2911 修复重启数据库后,多并发连接B数据库导致的重复加载插件的问题
Merge pull request !2911 from pengjiong/drop_ext
2023-02-16 08:34:08 +00:00
opengauss-bot 1c5977ee03
!2912 更新dss commit点支持dsstest编译
Merge pull request !2912 from zhaodu/dss
2023-02-16 08:16:40 +00:00
opengauss-bot 3f2da96ef6
!2900 修复full join+windows agg场景下找不到var的问题
Merge pull request !2900 from pengjiong/fix_col
2023-02-16 08:02:40 +00:00
opengauss-bot 157095553c
!2903 修复部分主备相关的内部线程通过pg_stat相关函数查询不到appname和create time的问题
Merge pull request !2903 from pengjiong/fix_case
2023-02-16 07:34:28 +00:00
opengauss-bot 0140f8d9f4
!2916 修改脚本
Merge pull request !2916 from xiaoxiao/master
2023-02-16 07:18:23 +00:00
zhaodu ae4379f8a4 更新dss commit点支持dsstest编译 2023-02-16 15:15:44 +08:00
xiaoxiao decca5a547 修改脚本 2023-02-16 14:20:42 +08:00
opengauss-bot dff7dc06c5
!2851 兼容MySQL支持隐藏索引
Merge pull request !2851 from chenxiaobin/newIndexInvisible
2023-02-16 05:09:09 +00:00
yuchao da54d69be9 修复配置jdbc驱动参数preferQueryMode为不同参数值,yat执行用例结果不一样的问题 2023-02-16 10:58:03 +08:00
totaj 3dac2a636a Add lock for loading so. 2023-02-15 19:34:53 +08:00
chenxiaobin19 ddd104c596 support invisible index 2023-02-15 18:13:39 +08:00
opengauss-bot 52dd7bc750
!2871 【MySQL兼容性】distinct支持order by带表达式。
Merge pull request !2871 from laishenghao/distinct-orderby
2023-02-15 07:26:40 +00:00
opengauss-bot a216c40a78
!2889 English spelling error
Merge pull request !2889 from zhang_jintao2020/spell_error
2023-02-15 02:47:58 +00:00
opengauss-bot 9d042874a6
!2909 DSS DMS commit点更新
Merge pull request !2909 from zhaobingyu/gauss_pkg
2023-02-14 14:35:42 +00:00
zhaobingyu 4d3d277e4e DSS DMS commit点更新 2023-02-14 22:00:10 +08:00
opengauss-bot 2e6ea6fd6c
!2907 修复gs_tar工具中help和version命令显示错误等问题
Merge pull request !2907 from zhangao/master_gstar
2023-02-14 09:22:33 +00:00
opengauss-bot 1ab1d8fb8c
!2904 [共享存储] 重置dms/dss日志路径
Merge pull request !2904 from 陈婷婷/master
2023-02-14 08:09:13 +00:00
opengauss-bot 7ba1b5ace1
!2897 【patch】调整gs_dump报错问题相关脚本的目录
Merge pull request !2897 from laishenghao/file-path
2023-02-14 07:56:10 +00:00
z00793368 9b4c93183a add gs_tar parameter description 2023-02-14 14:42:52 +08:00
totaj 229f58f82c Add pgstat for aux thread. 2023-02-14 10:49:31 +08:00
chentingting 3154c5a3b2 Revert "【共享存储】dms/dss 日志路径添加nodename"
This reverts commit 4b01d2fcdd.
2023-02-14 10:26:24 +08:00
chentingting 7f9abdab10 Revert "更新dms/dss日志路径"
This reverts commit e9f29064dd.
2023-02-14 10:25:31 +08:00
opengauss-bot ad8b8ebae2
!2876 函数PoolManagerCleanConnection中调用pg_usleep空转了500ms
Merge pull request !2876 from zhang_jintao2020/PoolManagerClean
2023-02-14 01:58:05 +00:00
opengauss-bot 2a4045fbca
!2899 【bugfixed】解决右值引用存在returning语句时core的问题
Merge pull request !2899 from laishenghao/rr-return
2023-02-13 10:53:36 +00:00
playrest 8e4a129c9b 禁止防篡改表的索引使用hash字段。 2023-02-13 18:00:38 +08:00
totaj 7d8eb9c1eb Fix fulljoin + windowsagg. 2023-02-13 16:43:56 +08:00
opengauss-bot a00323d24b
!2865 修复sys_connect_by_path函数找不到对应array_col的问题
Merge pull request !2865 from chenxiaobin/fixSWCB3
2023-02-13 08:43:18 +00:00
laishenghao 3b73572c0f 解决右值引用存在returning语句时core的问题 2023-02-13 15:55:25 +08:00
opengauss-bot 997b73e6e5
!2892 推进dss的commit点
Merge pull request !2892 from xiaoxiao/master
2023-02-13 06:19:51 +00:00
Laishenghao abcd3e6d1c 【patch】调整gs_dump报错问题相关脚本的目录 2023-02-13 12:02:50 +08:00
movead fde67e6c8b change var lastFlushPosition set location 2023-02-13 12:01:29 +08:00
opengauss-bot d913fac413
!2788 函数find_expr_references_walker内判断条件不准确
Merge pull request !2788 from foolishlee/find_expr_references_walker
2023-02-13 02:40:29 +00:00
zhangjintao c77d27b515 gsql 客户端\timing 计时开关打开后,显示时间错误 2023-02-10 22:48:41 -08:00
zhangjintao 13d461869b 同时指定no-locale和locale参数时,gs_initdb出现coredump 2023-02-10 22:38:38 -08:00
xiaoxiao ed4d38e6f3 推进dss的commit点 2023-02-11 11:23:06 +08:00
opengauss-bot 0613f8eedd
!2762 函数instr_stmt_dynamic_change_level内部枚举比较不准确
Merge pull request !2762 from foolishlee/instr_stmt_dynamic_change_level
2023-02-10 09:01:33 +00:00
opengauss-bot 28fa2ea9d2
!2882 【bugfixed】解决insert语句右值引用不支持jdbc方式,以及列存在not null约束时默认值与MySQL不一致的问题,修改加入rules用例到fastcheck
Merge pull request !2882 from laishenghao/rr-bf
2023-02-09 12:14:31 +00:00
opengauss-bot a269bc1879
!2885 修复dolphin插件在并发场景下会话未调初始化会话级hook的问题
Merge pull request !2885 from chenxiaobin/fixParall
2023-02-09 11:20:00 +00:00
teooooozhang ab2770058c issue修复:操作符优先级问题导致特定表达式语法解析失败问题修复 2023-02-09 18:47:09 +08:00
totaj c81eaed21c Fix SWCB core. 2023-02-09 18:29:53 +08:00
zhangjintao 4206ad5258 English spelling error 2023-02-09 01:33:16 -08:00
laishenghao 9186031f99 解决insert语句右值引用不支持jdbc方式,以及列存在not null约束时默认值与MySQL不一致的问题,修改加入rules用例到fastcheck 2023-02-09 14:23:45 +08:00
opengauss-bot c46c2b307b
!2883 修改dss脚本
Merge pull request !2883 from xiaoxiao/master
2023-02-09 03:26:03 +00:00
xiaoxiao 8e1ab60a33 修改脚本 2023-02-09 09:52:39 +08:00
chenxiaobin19 67ea04610e 修复并发场景下会话未调初始化会话级hook的问题 2023-02-08 21:51:29 +08:00
opengauss-bot 1d05bff955
!2869 修复开启partial seq scan后Seq Scan算子初始化期间core
Merge pull request !2869 from 陈栋/bugfix
2023-02-08 12:47:37 +00:00
chendong76 78ea45ca13 修复开启partial seq scan后Seq Scan算子初始化期间core 2023-02-08 16:32:28 +08:00
opengauss-bot bf0506a1eb
!2879 回退 'Pull Request !2845 : 【bugfixed】解决insert语句右值引用不支持jdbc方式;以及列存在not null约束时默认值与MySQL不一致的问题'
Merge pull request !2879 from pengjiong/revert-merge-2845-master
2023-02-08 04:05:23 +00:00
pengjiong aa27f6ccc4
回退 'Pull Request !2845 : 【bugfixed】解决insert语句右值引用不支持jdbc方式;以及列存在not null约束时默认值与MySQL不一致的问题' 2023-02-08 03:32:54 +00:00
opengauss-bot 018162771f
!2875 更新版本号至5.0.0
Merge pull request !2875 from 蒋宏博/5.0.0
2023-02-08 03:22:12 +00:00
opengauss-bot 8cec403fac
!2877 更新DMS和DSS commit点,解决cm_res_get_stat并发导致的内存问题
Merge pull request !2877 from peibaoyi/master
2023-02-08 02:10:25 +00:00
peibaoyi 5091b95a60 1. 适配cbb/dms/dss cm_res_get_stat接口变更
2. ss_log_max_file_size参数变更时size单位需要乘上1024
3. 适配dms_api.h版本号变更
2023-02-07 19:47:08 +08:00
zhangjintao b17472efe8 PoolManagerCleanConnection中调用pg_usleep空转了500ms 2023-02-07 00:38:27 -08:00
jianghongbo4 dcdc9101ab 更新版本号至5.0.0 2023-02-07 15:39:45 +08:00
opengauss-bot 39c2d3eeef
!2845 【bugfixed】解决insert语句右值引用不支持jdbc方式;以及列存在not null约束时默认值与MySQL不一致的问题
Merge pull request !2845 from laishenghao/rightref-bugfixed
2023-02-07 06:15:53 +00:00
opengauss-bot d94dc71271
!2735 函数calculateThreadMemoryContextStats内判断proc->myProgName != NULL不准确
Merge pull request !2735 from foolishlee/calculateThreadMemoryContextStats
2023-02-07 03:58:58 +00:00
laishenghao 7e8e9de6a2 解决insert语句右值引用不支持jdbc方式;以及列存在not null约束时默认值与MySQL不一致的问题 2023-02-07 11:32:07 +08:00
wanghao19920907 7c60335e24 添加安全函数返回值检查 2023-02-06 19:14:29 -08:00
chenxiaobin19 70d832ed9f fix internal array_col not found bug 2023-02-07 11:12:35 +08:00
wanghao19920907 214297acef 添加安全函数返回值检查 2023-02-06 19:02:08 -08:00
opengauss-bot 39a27de267
!2861 修复部分内部线程通过pg_stat相关函数查询不到appname和create time的问题
Merge pull request !2861 from pengjiong/fix_col
2023-02-07 02:04:12 +00:00
opengauss-bot 08982ec182
!2867 修复非B兼容性下,由于未设置yyloc导致使用自定义变量的core问题
Merge pull request !2867 from pengjiong/fix_date
2023-02-07 01:37:18 +00:00
opengauss-bot fd79300905
!2780 on update 处理找不到类型比较函数
Merge pull request !2780 from 吕辉/on_update_bugfix
2023-02-06 12:47:25 +00:00
laishenghao 8d5b8af09c 增加distinct+orderby支持表达式、未选字段的功能 2023-02-06 20:02:09 +08:00
chenxiaobin19 8dd624aff8 修复异常场景连接未关闭问题 && 补充测试用例 2023-02-06 17:53:29 +08:00
lvhui 939cdc8855 add test case 2023-02-06 17:35:12 +08:00
wanghao19920907 c69efe24e4 必要时增加hashjoin的bucket数量 2023-02-06 00:57:37 -08:00
totaj 3435e4fc9b Fix have not set yyloc when using @var. 2023-02-06 16:29:13 +08:00
opengauss-bot 2b0c6e1870
!2849 适配dss支持主备切换
Merge pull request !2849 from 陈超/glt
2023-02-06 08:29:03 +00:00
l30039603 b2b4ee913c 补充测试用例 2023-02-06 15:17:53 +08:00
wanghao19920907 81646fb183 修复init_var_from_num中性能瓶颈 2023-02-05 22:57:53 -08:00
lvhui a3f544a28a fix issue I6CG33 2023-02-06 14:52:33 +08:00
lvhui 4918e0f7ec fix on update attribute handle some type could not find a comparison function
fix typOid error
2023-02-06 14:52:21 +08:00
陈超 addf3145ff Merge branch 'master' of gitee.com:opengauss/openGauss-server into glt
Signed-off-by: 陈超 <1790599142@qq.com>
2023-02-03 13:04:42 +00:00
opengauss-bot 7ac947b7c3
!2863 【共享存储】更新dms commit点
Merge pull request !2863 from 陈婷婷/master
2023-02-03 12:35:12 +00:00
chentingting 14542b84e7 更新dms commit点 2023-02-03 19:25:05 +08:00
opengauss-bot 6639c84dcd
!2862 【共享存储】更新dms/dss日志路径
Merge pull request !2862 from 陈婷婷/master
2023-02-03 11:02:31 +00:00
chenchao 4f3505328f dss支持主备切换 2023-02-03 17:40:44 +08:00
chentingting e9f29064dd 更新dms/dss日志路径 2023-02-03 17:27:57 +08:00
opengauss-bot 3ba06d6995
!2779 函数is_stmt_allowed_in_locked_mode返回代码冗余
Merge pull request !2779 from foolishlee/is_stmt_allowed_in_locked_mode
2023-02-03 07:05:15 +00:00
opengauss-bot dfe74a3630
!2859 [共享存储]修复failover发生后主机在回放阶段淘汰了从备机要到的需要flush的页面, 导致磁盘上页面漏刷的问题
Merge pull request !2859 from cchen676/1207master
2023-02-03 06:44:37 +00:00
totaj 1d57ca36ad Let internal thread report appname and status. 2023-02-03 14:14:32 +08:00
opengauss-bot 6ce57b1f10
!2860 修复DSS没有debug日志的问题
Merge pull request !2860 from jihanyu/master
2023-02-03 01:20:36 +00:00
opengauss-bot 49dd399971
!2858 【共享存储】【I6B4IS】避免GROUP_ZERO中的mes worker线程在调用 CBGetTxnStatus陷入死循环
Merge pull request !2858 from 董宁/dn_fix3_up
2023-02-02 09:21:26 +00:00
jihanyu 9ffe8a74d3 修复DSS没有debug日志的问题 2023-02-02 16:30:00 +08:00
arcoalien@qq.com 053aadfa38 修复failover发生后主机在回放阶段淘汰了从备机要到的需要flush的页面, 导致磁盘上页面漏刷的问题 2023-02-02 15:47:58 +08:00
dongning12 ed3d27a228 [共享存储] forbid mes_task_proc looping infinitely 2023-02-02 15:00:58 +08:00
opengauss-bot a0498a5701
!2781 函数SPI_get_top_transaction_id针对ENABLE_MULTIPLE_NODES流程判断冗余
Merge pull request !2781 from foolishlee/SPI_get_top_transaction_id
2023-02-02 06:42:00 +00:00
opengauss-bot a9c3b8aaad
!2772 变量versionControl和licenseControl中结构体数组字段赋值不准确
Merge pull request !2772 from foolishlee/LicenseControl
2023-02-02 06:40:11 +00:00
opengauss-bot 266a7c0f23
!2770 函数has_shippable_col_for_insert内最后退出代码冗余
Merge pull request !2770 from foolishlee/has_shippable_col_for_insert
2023-02-02 06:39:52 +00:00
opengauss-bot 83c42e025c
!2769 函数JoinPathGenBase::streamSidePath内最后return NULL为冗余代码
Merge pull request !2769 from foolishlee/streamSidePath
2023-02-02 06:39:25 +00:00
opengauss-bot 8e889c3580
!2768 函数create_paritial_push_plan内返回代码冗余
Merge pull request !2768 from foolishlee/create_paritial_push_plan
2023-02-02 06:38:16 +00:00
opengauss-bot cc567d77f8
!2749 函数ProcedureCreate内判断parameterTypes为空代码不准确
Merge pull request !2749 from foolishlee/ProcedureCreate_Datum
2023-02-02 06:37:36 +00:00
opengauss-bot 1d369d673d
!2750 函数get_random_job_id内部判断job_max_number范围不准确会导致后续异常
Merge pull request !2750 from foolishlee/get_random_job_id
2023-02-02 06:33:16 +00:00
opengauss-bot e88d61db72
!2856 rename table特性bug修复
Merge pull request !2856 from 吕辉/rename_bugfix
2023-02-02 06:18:15 +00:00
lvhui 0248a0915d add rename table test case 2023-02-02 11:06:12 +08:00
lvhui 38fbc348e9 fix issue I6BXUY 2023-02-02 10:46:18 +08:00
opengauss-bot acb6439192
!2853 【共享存储】dms/dss 日志路径添加nodename
Merge pull request !2853 from 陈婷婷/dms_log
2023-02-01 10:56:34 +00:00
opengauss-bot a49fe42310
!2854 【共享存储】删除参数ss_enable_log_level
Merge pull request !2854 from 陈婷婷/master
2023-02-01 10:55:35 +00:00
opengauss-bot 57d53542c5
!2855 [共享存储]修复在DMS在 PageCheckIfCanEliminate 中问题
Merge pull request !2855 from 董宁/dn_fix4_up
2023-02-01 09:31:50 +00:00
dongning12 d910ee9d7d [共享存储] add page accessible check & fix PageCheckIfCanEliminate problem in dms 2023-02-01 16:21:50 +08:00
chentingting 4b01d2fcdd 【共享存储】dms/dss 日志路径添加nodename 2023-02-01 16:04:06 +08:00
chentingting 03439a28ed 【共享存储】 删除参数ss_enable_log_level 2023-02-01 15:45:36 +08:00
opengauss-bot 017c9329f8
!2847 【共享存储】Failover GetXlogBuffer crash修复, reset wal buffer仅在startup线程拉起时执行一次, 否则无法正确推进redo LSN
Merge pull request !2847 from 刘博文/1dev
2023-01-31 14:17:31 +00:00
opengauss-bot 1276c3af87
!2835 解决pg、b兼容模式下中文字符串显式转换宕机问题
Merge pull request !2835 from 李秦朗/master
2023-01-31 08:43:22 +00:00
cc_db_dev 57ed20e0c7 提升numeric除法性能 2023-01-31 14:06:05 +08:00
opengauss-bot 6d4cfc8074
!2846 [Bugfix] 修复在standbywrite开启线程池时提示备机连接主机失败的问题
Merge pull request !2846 from 周斌/master
2023-01-31 02:34:57 +00:00
opengauss-bot 4a46a8b01f
!2833 修复synonym命名冲突但仍然允许通过的问题
Merge pull request !2833 from Cross-罗/synonym_bugfix
2023-01-31 02:16:09 +00:00
opengauss-bot 85b82c5d63
!2834 修改issue: pg_resetxlog执行失败报错提示不合理
Merge pull request !2834 from zhaobingyu/master
2023-01-31 02:12:39 +00:00
bowenliu a8bace43ed fix failover getxlogbuffer 2023-01-31 09:33:20 +08:00
zhaobingyu fd1efa9d41 修改issue: pg_resetxlog执行失败报错提示不合理 2023-01-31 09:10:43 +08:00
opengauss-bot a166122e2a
!2763 函数isSameArgList内sprintf_s调用参数类型不正确
Merge pull request !2763 from foolishlee/isSameArgList
2023-01-30 11:41:08 +00:00
opengauss-bot ae9161f30b
!2837 修复simpleInstall安装数据库端口占用判断错误问题
Merge pull request !2837 from 蒋宏博/master
2023-01-30 11:40:32 +00:00
opengauss-bot 6a8b208831
!2841 【共享存储】拦截非NORMAL STANDBY下的Switchover指令
Merge pull request !2841 from 刘博文/1dev
2023-01-30 09:12:09 +00:00
justbk 48193b6c39 [libpqsw]repair invalid username when enable thread pool 2023-01-30 16:47:59 +08:00
bowenliu 5aa5ef9406 fix switchover trigger 2023-01-30 11:14:44 +08:00
lilong 6e4d1695c3 取消strcpy_s返回值检查 2023-01-30 10:19:47 +08:00
lilong 5e89b830ea 及时释放NameListToString内分配的内存 2023-01-29 10:42:23 +08:00
jianghongbo4 8151036ef1 修复极简安装端口占用判断错误问题 2023-01-28 15:04:49 +08:00
movead 5371d0d06b modify gs_probackup it will feedback wal lsn to master after write to wal file 2023-01-28 14:24:26 +08:00
opengauss-bot 95a55bfd2b
!2761 DRC validate
Merge pull request !2761 from 刘博文/master
2023-01-20 02:51:51 +00:00
luozihao bce67e3981 修复synonym允许冲突的问题 2023-01-19 11:02:22 +08:00
l30039603 d1a82a168c 解决pg、b兼容模式中文字符串转换问题 2023-01-19 11:00:14 +08:00
opengauss-bot b2a5d20e8b
!2827 创建行存压缩表,对表并发执行insert/update/delete/vacuum/analyze/vacuum full等操作,频繁出现报错ERROR: Failed to CfsWritePage base/16384/34396_compress
Merge pull request !2827 from 吴岳川/master
2023-01-19 01:58:12 +00:00
opengauss-bot 903ad22881
!2830 [共享存储]fix bug about xlog not recycling
Merge pull request !2830 from zhengxue/master_dev
2023-01-18 10:29:45 +00:00
opengauss-bot b6c9289c28
!2832 轻量版适配openEuler 2203 LTS
Merge pull request !2832 from 蒋宏博/oel2203
2023-01-18 07:45:42 +00:00
jianghongbo4 952316ac44 轻量版适配openEuler 22.03 LTS 2023-01-18 15:00:27 +08:00
shirley_zhengx a06722de46 [共享存储]fix bug xlog not recycling 2023-01-18 11:51:55 +08:00
opengauss-bot b5ad4c2b99
!2764 函数ProcedureCreate内paramModes相关代码修正
Merge pull request !2764 from foolishlee/ProcedureCreate_paramModes
2023-01-18 03:16:09 +00:00
opengauss-bot c63fa868a4
!2755 函数ClearYylval的修饰关键字inline应放在返回类型前
Merge pull request !2755 from foolishlee/ClearYylval
2023-01-18 03:14:41 +00:00
opengauss-bot a594de56a2
!2752 函数IsInSameTransaction的修饰关键字inline应放在返回类型前
Merge pull request !2752 from foolishlee/IsInSameTransaction
2023-01-18 03:14:21 +00:00
opengauss-bot 2c420738c8
!2757 函数estimate_cstore_blocks内部变量total_pages判断条件不准确
Merge pull request !2757 from foolishlee/estimate_cstore_blocks
2023-01-18 03:13:46 +00:00
opengauss-bot a504ddfca4
!2758 函数estimatePartitionSize内部变量curpages判断条件不准确
Merge pull request !2758 from foolishlee/estimatePartitionSize
2023-01-18 03:13:33 +00:00
opengauss-bot 2fb6d4321e
!2765 函数base64_decode内变量inlen判断条件不准确
Merge pull request !2765 from foolishlee/base64_decode
2023-01-18 03:12:59 +00:00
opengauss-bot 205274dc7a
!2785 函数MakeDefaultSubpartition返回值代码冗余
Merge pull request !2785 from foolishlee/MakeDefaultSubpartition
2023-01-18 03:05:03 +00:00
opengauss-bot aac1c3b0c0
!2826 【共享存储】分布式锁部分场景bugfix
Merge pull request !2826 from 陈栋/bugfix
2023-01-18 02:15:11 +00:00
opengauss-bot 2e319d7c34
!2828 【共享存储】doublewrite多次初始化导致校验crash
Merge pull request !2828 from 刘博文/1dev
2023-01-18 01:27:21 +00:00
chendong76 b379970732 分布式锁部分场景bugfix 2023-01-17 20:56:05 +08:00
opengauss-bot de3891c54e
!2815 解决protocol_config未初始化引发的空指针问题
Merge pull request !2815 from 陈栋/bugfix2
2023-01-17 12:26:38 +00:00
bowenliu 5ef3bc90a3 1 2023-01-17 20:14:51 +08:00
bowenliu 0c6d9a88a9 drc validate 2023-01-17 19:58:22 +08:00
opengauss-bot c5aa3fa255
!2806 【轻量级PR】修改alter subpartition的value为语法必选项
Merge pull request !2806 from 李秦朗/master
2023-01-17 11:47:50 +00:00
wuyuechuan 396d15ee5a skip report error when fork was removed 2023-01-17 19:47:00 +08:00
chendong76 37177fdf62 解决protocol_config未初始化引发的空指针问题 2023-01-17 17:35:44 +08:00
opengauss-bot 9036e64955
!2707 修改issue:保证在备机执行pg_resetxlog工具合理报错
Merge pull request !2707 from zhaobingyu/master
2023-01-17 03:36:49 +00:00
opengauss-bot aaff16b088
!2813 【共享存储】【DTS2023010305621】共享存储对于双写部分调整
Merge pull request !2813 from 董宁/ss_fix6_up
2023-01-17 02:20:29 +00:00
zhaobingyu e2c37735de 修改issue: 保证在备机执行pg_resetxlog工具合理报错 2023-01-17 09:58:16 +08:00
opengauss-bot be1ac1dee9
!2820 设置wdr_snapshot_interval生成快照时间间隔未立即生效
Merge pull request !2820 from 陈志凯/master
2023-01-17 01:45:41 +00:00
ab2020c bd74fed434 合并pg pr:集中逻辑保护复制的效用语句 2023-01-17 09:40:11 +08:00
opengauss-bot b658f54c31
!2818 修改issue: gs_probackup恢复后数据丢失
Merge pull request !2818 from zhaobingyu/gs_probackup
2023-01-16 11:20:41 +00:00
wanghao19920907 cbb5b4fe37 执行器优化,改为函数指针的方式,不访问全局数组 2023-01-16 01:49:05 -08:00
zhaobingyu 6a29713e6d 修改issue: gs_probackup恢复后数据丢失 2023-01-16 17:35:12 +08:00
chenzhikai ee1e3b25fe 设置wdr_snapshot_interval生成快照时间间隔未立即生效 2023-01-16 17:31:29 +08:00
opengauss-bot 98cbf84e7f
!2810 修复创建函数给参数指定参数模式为INOUT并且指定默认值报错的bug
Merge pull request !2810 from Cross-罗/inout_fix
2023-01-16 09:12:01 +00:00
opengauss-bot 30b4e5c253
!2816 【共享存储】基于cm模拟文件的HA测试框架以及各个场景用例
Merge pull request !2816 from 董宁/dn_fix1
2023-01-16 07:22:45 +00:00
opengauss-bot 0b8e1fcf82
!2812 修复CTE+子查询场景下,CTE重复处理导致找不到CTE pathlist的问题
Merge pull request !2812 from pengjiong/fix_col
2023-01-16 03:45:03 +00:00
dongning12 d465c8fecf [共享存储] 基于cm模拟文件的HA场景用例 2023-01-16 11:19:48 +08:00
dongning12 ded16a65b4 [共享存储] dw adapt shared_storage 2023-01-14 17:16:44 +08:00
totaj 2313bec17e Fix cte with subquery failed. 2023-01-14 16:28:50 +08:00
opengauss-bot eee21b1180
!2811 【共享存储】【bugfix】【DTS2022120508091】failover出现backend无法退掉,30s后直接重启
Merge pull request !2811 from 董宁/ss_fix5_up
2023-01-14 07:33:35 +00:00
dongning12 f984b85ce6 [共享存储] failover: restart when backend exit failed 2023-01-14 14:46:37 +08:00
opengauss-bot dc671f1cea
!2700 修复:psql 和B模式的delimiter 冲突的问题
Merge pull request !2700 from chenbd/bug_fix_delimiter
2023-01-14 06:26:16 +00:00
opengauss-bot 50ed45f280
!2807 【共享存储】修复invalid shared copy和获取页面并发时, 当IO未完成时, invalid可能导致页面实际为失效
Merge pull request !2807 from cchen676/1207master
2023-01-14 06:04:41 +00:00
luozihao e130660c6a 修复INOUT不能设置默认值的bug 2023-01-14 10:08:59 +08:00
opengauss-bot b5dc67ccdb
!2808 【共享存储】解决failover过程中RecoveryInProgress不符合预期
Merge pull request !2808 from 董宁/ss_fix3_up
2023-01-13 08:21:50 +00:00
dongning12 500d43fd7a [共享存储] failed to judge RecoveryInProgress in failover 2023-01-13 15:13:18 +08:00
arcoalien@qq.com 66c2ca3481 修复invalid shared copy和获取页面并发时, 当IO未完成时, invalid可能导致页面实际为失效 2023-01-13 10:35:06 +08:00
l30039603 a80de88a0f \h修改alter subpartition的VALUES为语法必选项 2023-01-13 10:16:20 +08:00
opengauss-bot fc359a7d90
!2802 多个函数存在变量比较不准确问题
Merge pull request !2802 from foolishlee/unsigned
2023-01-12 07:30:17 +00:00
opengauss-bot 2e4f56c422
!2803 [共享存储] dms_api.h文件适配修改
Merge pull request !2803 from 陈婷婷/master
2023-01-12 01:19:49 +00:00
opengauss-bot b80bcf9eb5
!2782 修改适配GSC开启后备机对全局失效消息的处理
Merge pull request !2782 from cchen676/1207master
2023-01-11 14:01:24 +00:00
chentingting 713da47bf5 【共享存储】 适配dms头文件修改 2023-01-11 20:33:05 +08:00
opengauss-bot 2e760ad0ee
!2774 添加List分区的partitionmap排序
Merge pull request !2774 from chenxiaobin/addListSort
2023-01-11 11:25:53 +00:00
opengauss-bot bec5136b6a
!2783 issue修复:ignore在向主键列插入null时资源泄漏修复
Merge pull request !2783 from zhangzhixian/pg_ctl_revise
2023-01-11 08:40:45 +00:00
lilong d6b75f5fc6 多个函数存在变量比较不准确问题 2023-01-11 15:54:34 +08:00
opengauss-bot 9cc27bc424
!2798 共享存储模式pg_controldata工具只打印有效页和最后一页
Merge pull request !2798 from zhaobingyu/pg_controldata
2023-01-11 07:40:39 +00:00
arcoalien@qq.com 7946661d31 修改适配GSC开启后备机对全局失效消息的处理 2023-01-11 14:56:22 +08:00
teooooozhang 9e6b14bd1c issue修复:ignore在向主键列插入null时资源泄漏修复 2023-01-11 14:48:17 +08:00
chenxiaobin19 93677e4261 add listmap sort 2023-01-11 14:35:28 +08:00
opengauss-bot d2cbd2bfc0
!2801 更新DMS/DSS commit点
Merge pull request !2801 from 陈婷婷/master
2023-01-11 06:24:00 +00:00
chentingting 9203452e00 更新DMS/DSS commit点 2023-01-11 11:25:31 +08:00
opengauss-bot 2458165e05
!2796 1. fix DSS logger timer proc deadlock bug 2. fix switchover hang after reform has failed
Merge pull request !2796 from 刘博文/1dev
2023-01-11 01:28:53 +00:00
zhaobingyu 272de26f63 共享存储模式pg_controldata工具只打印有效页和最后一页 2023-01-10 20:41:37 +08:00
opengauss-bot e213cad320
!2799 gs_initdb增加--dms_url的help说明
Merge pull request !2799 from zhaobingyu/gs_initdb
2023-01-10 11:44:57 +00:00
zhaobingyu 9889e4edec 共享存储模式增加gs_initdb的--dms_url帮助说明 2023-01-10 17:19:51 +08:00
bowenliu 22ec06468a fix init logger causing libc deadlocks 2023-01-10 15:22:53 +08:00
opengauss-bot 3ffa07e987
!2793 支持openEuler 22.03 LTS系统
Merge pull request !2793 from 蒋宏博/oel2203
2023-01-10 07:02:44 +00:00
opengauss-bot 540298301c
!2790 DSS/DMS日志独立
Merge pull request !2790 from jihanyu/master
2023-01-10 06:38:04 +00:00
opengauss-bot 187ef591d7
!2794 fix bug upgrade about hdfs_fdw
Merge pull request !2794 from zhengxue/master_dev
2023-01-10 02:50:27 +00:00
jihanyu 826bddb3a6 DMS/DSS日志独立 2023-01-10 09:38:20 +08:00
opengauss-bot 9e9a30ae7a
!2789 修复alter role的core问题
Merge pull request !2789 from pengjiong/fix_date
2023-01-10 01:29:51 +00:00
opengauss-bot c8913da1e5
!2791 修复plpgsql_parse_wordtype函数未判空问题
Merge pull request !2791 from pengjiong/fix_col
2023-01-09 13:06:46 +00:00
shirley_zhengx a3e2f50179 fix bug upgrade about hdfs_fdw 2023-01-09 20:53:56 +08:00
totaj 151f38670c Fix package core. 2023-01-09 17:57:22 +08:00
jianghongbo4 ee12972524 支持openEuler 2203 LTS系统 2023-01-09 16:47:20 +08:00
totaj 353ed2248a Fix alter role core. 2023-01-09 16:16:01 +08:00
lilong 276c86eebc 函数find_expr_references_walker内判断条件不准确 2023-01-09 15:50:00 +08:00
lilong 273bab793d 函数MakeDefaultSubpartition返回值代码冗余 2023-01-09 14:52:16 +08:00
lilong 492a17d205 函数WLMAdjustCGroup4EachThreadOnDN内比较不准确 2023-01-09 14:43:26 +08:00
opengauss-bot 66242b6844
!2658 【共享存储】【bugfix】避免因为启动时的NORAML_MODE导致节点被反复启停
Merge pull request !2658 from 董宁/ss_fix1_up
2023-01-09 06:32:22 +00:00
lilong b07afd5c66 函数SPI_get_top_transaction_id针对ENABLE_MULTIPLE_NODES流程判断冗余 2023-01-09 10:51:50 +08:00
lilong 6c51a4b230 函数is_stmt_allowed_in_locked_mode返回代码冗余 2023-01-09 10:37:30 +08:00
lilong b635f0aa19 函数IsQidInvalid内条件判断不准确 2023-01-09 09:56:30 +08:00
opengauss-bot e7ff8013f6
!2746 函数GetOldestXminForHot的修饰关键字inline应放在返回类型前
Merge pull request !2746 from foolishlee/GetOldestXminForHot
2023-01-09 01:38:14 +00:00
opengauss-bot 5da26aaca3
!2771 生成WDR性能报告时,node_name给为异常值/非当前节点值,数据库挂掉
Merge pull request !2771 from 陈志凯/master
2023-01-06 13:46:01 +00:00
chenzhikai 211353e5ab 生成WDR性能报告时,node_name给为异常值/非当前节点值,数据库挂掉 2023-01-06 17:01:40 +08:00
opengauss-bot 60b789535f
!2747 修复definer用户带有大写字母时导入导出出错的bug
Merge pull request !2747 from Cross-罗/algo_core
2023-01-06 08:54:37 +00:00
lilong ba3ff0446e 变量versionControl和licenseControl中结构体数组字段赋值不准确 2023-01-06 15:27:52 +08:00
lilong 12ec2ab34c 函数has_shippable_col_for_insert内最后退出代码冗余 2023-01-06 14:59:59 +08:00
lilong 14612cfaf0 函数JoinPathGenBase::streamSidePath内最后return NULL为冗余代码 2023-01-06 14:53:42 +08:00
lilong 0ad8e3b944 函数create_paritial_push_plan内返回代码冗余 2023-01-06 14:28:07 +08:00
opengauss-bot d66dbc1ece
!2724 函数pgaudit_ProcessUtility内T_CreatePackageBodyStmt分支缺少break语句
Merge pull request !2724 from foolishlee/pgaudit_ProcessUtility_break
2023-01-06 06:12:19 +00:00
opengauss-bot 2217e1eec8
!2737 函数pgaudit_ProcessUtility内T_AlterTableStmt分支判断sequence有误
Merge pull request !2737 from foolishlee/pgaudit_ProcessUtility_relkind
2023-01-06 06:11:05 +00:00
opengauss-bot 4a2383375d
!2730 gs_ctl启动/停止时根据配置文件的data_directory执行启动/停止
Merge pull request !2730 from zhangzhixian/pg_ctl_revise
2023-01-06 03:13:58 +00:00
lilong 3a24ebbc61 函数gs_r_release_comm_memory内变量cmailbox->buff_q->u_size判断不准确 2023-01-06 11:12:50 +08:00
lilong 1e1fbf2c99 函数base64_decode内变量inlen判断条件不准确 2023-01-06 10:35:05 +08:00
lilong a4ee5b26b6 函数ProcedureCreate内paramModes相关代码修正 2023-01-06 10:22:46 +08:00
lilong 31cec9afc3 函数isSameArgList内sprintf_s调用参数类型不正确 2023-01-06 09:51:11 +08:00
opengauss-bot 709801983e
!2760 解决开启最大可用模式后,集群无法启动问题
Merge pull request !2760 from wenger/fix_ha_bug
2023-01-06 01:20:16 +00:00
lilong 929d416846 函数instr_stmt_dynamic_change_level内部枚举比较不准确 2023-01-06 09:19:16 +08:00
opengauss-bot 0800cec028
!2739 函数getPrivateModeDataNodeTask内拼接路径使用‘\’
Merge pull request !2739 from foolishlee/getPrivateModeDataNodeTask
2023-01-05 12:42:59 +00:00
潘浩文 8763f363f1 解决开启最大可用模式后,集群无法启动问题 2023-01-05 20:34:43 +08:00
opengauss-bot 30c251bb0a
!2728 修复了极致RTO回放流程获取buffer函数XLogReadBufferForRedoBlockExtend()传参错误
Merge pull request !2728 from jiangzhaoheng/extreme_rto_func_parameter_bugfix
2023-01-05 08:20:30 +00:00
opengauss-bot 3f30b9f992
!2726 函数_outNode内T_NoGPCHint分支缺少break语句
Merge pull request !2726 from foolishlee/_outNode
2023-01-05 07:51:09 +00:00
lilong 0dda70971c 函数estimatePartitionSize内部变量curpages判断条件不准确 2023-01-05 15:10:57 +08:00
opengauss-bot 50502f0c78
!2727 函数InitConfigureNamesBool内部结构localConfigureNamesBool赋值有误
Merge pull request !2727 from foolishlee/InitConfigureNamesBool
2023-01-05 06:55:03 +00:00
lilong 394de98564 函数estimate_cstore_blocks内部变量total_pages判断条件不准确 2023-01-05 14:52:20 +08:00
lilong f1fe8cf4dc 函数ClearYylval的修饰关键字inline应放在返回类型前 2023-01-05 14:03:48 +08:00
lilong ed6dc5f3fc 函数InitConfigureNamesBool内部结构localConfigureNamesBool赋值有误 2023-01-05 12:38:21 +08:00
opengauss-bot d8b7f4ab74
!2744 函数IsConvertableType的修饰关键字inline应放在返回类型前
Merge pull request !2744 from foolishlee/IsConvertableType
2023-01-05 03:28:33 +00:00
lilong 357aa8fccd 函数IsInSameTransaction的修饰关键字inline应放在返回类型前 2023-01-05 11:07:40 +08:00
opengauss-bot da120693c6
!2740 函数StrToInt32内部判断范围代码无效
Merge pull request !2740 from foolishlee/StrToInt32
2023-01-05 02:59:41 +00:00
opengauss-bot 527df86513
!2729 函数GetPartOidByATcmd内部枚举值PART_AREA_INTERVAL使用有误
Merge pull request !2729 from foolishlee/GetPartOidByATcmd
2023-01-05 02:57:02 +00:00
opengauss-bot 97521070b7
!2725 函数CreateAlterTableCommandTag内AT_EncryptionKeyRotation分支缺少break语句
Merge pull request !2725 from foolishlee/CreateAlterTableCommandTag
2023-01-05 02:53:28 +00:00
opengauss-bot f352beb8b1
!2723 函数GaussDbThreadMain内有些分支缺少break语句
Merge pull request !2723 from foolishlee/GaussDbThreadMain
2023-01-05 02:52:36 +00:00
opengauss-bot 76e1753640
!2745 函数init_tabentry_truncate的修饰关键字inline应放在返回类型前
Merge pull request !2745 from foolishlee/init_tabentry_truncate
2023-01-05 02:48:03 +00:00
opengauss-bot d305926560
!2743 函数SetExtraThreadInfo内BGWORKER分支缺少break语句
Merge pull request !2743 from foolishlee/SetExtraThreadInfo
2023-01-05 02:47:31 +00:00
opengauss-bot 73993b6e72
!2742 函数GetTupleForTrigger内goto标签ltrmark后不需要分号
Merge pull request !2742 from foolishlee/GetTupleForTrigger
2023-01-05 02:46:54 +00:00
opengauss-bot b7578a6751
!2741 函数DropWeakPasswordDictionary内部判断rel代码有误
Merge pull request !2741 from foolishlee/DropWeakPasswordDictionary
2023-01-05 02:46:22 +00:00
opengauss-bot f65d34d779
!2721 函数VerifyDestDirIsEmptyOrCreate内case 0分支缺少break语句
Merge pull request !2721 from foolishlee/VerifyDestDirIsEmptyOrCreate
2023-01-05 02:38:50 +00:00
opengauss-bot cd43fd54aa
!2720 函数getlen_stream中RESPONSE_DATAROW分支直接return后续代码无效
Merge pull request !2720 from foolishlee/getlen_stream
2023-01-05 02:35:33 +00:00
lilong 6ed7974808 函数get_random_job_id内部判断job_max_number范围不准确会导致后续异常 2023-01-05 10:13:14 +08:00
lilong 6322b41b89 函数ProcedureCreate内判断parameterTypes为空代码不准确 2023-01-05 09:45:47 +08:00
opengauss-bot 42c3e1f30d
!2736 Revert a minor change for MOT
Merge pull request !2736 from Vinoth Veeraraghavan/master
2023-01-05 01:41:28 +00:00
luozihao 4b2792814a 修复definer用户带有大写字母时导入导出出错的bug 2023-01-04 20:34:08 +08:00
lilong 1afe404b40 函数GetOldestXminForHot的修饰关键字inline应放在返回类型前 2023-01-04 17:10:17 +08:00
lilong 3c5ecbf300 函数init_tabentry_truncate的修饰关键字inline应放在返回类型前 2023-01-04 17:02:07 +08:00
lilong 4b1fce8060 函数IsConvertableType的修饰关键字inline应放在返回类型前 2023-01-04 15:53:14 +08:00
lilong bca6e9ece5 函数SetExtraThreadInfo内BGWORKER分支缺少break语句 2023-01-04 15:20:58 +08:00
lilong a361d8f4a3 使用空格键代替tab 2023-01-04 15:06:12 +08:00
lilong 0762036bb3 函数StrToInt32内部判断范围代码无效 2023-01-04 14:49:00 +08:00
lilong 3c0927c7e2 函数GetTupleForTrigger内goto标签ltrmark后不需要分号 2023-01-04 14:26:51 +08:00
lilong e1c10dafb4 函数DropWeakPasswordDictionary内部判断rel代码有误 2023-01-04 14:13:28 +08:00
lilong 437d1ff9bd 函数getPrivateModeDataNodeTask内拼接路径使用‘\’ 2023-01-04 10:58:35 +08:00
lilong 70e850a384 函数pgaudit_ProcessUtility内T_AlterTableStmt分支判断sequence有误 2023-01-04 10:36:42 +08:00
Vinoth Veeraraghavan e5c2b913ba Revert a minor change for MOT 2023-01-04 09:49:26 +08:00
opengauss-bot fefebd6a20
!2628 添加plannerHook
Merge pull request !2628 from 仲夏十三/mas9
2023-01-04 01:25:02 +00:00
lilong 73cff1dff0 函数calculateThreadMemoryContextStats内判断proc->myProgName != NULL不准确 2023-01-04 09:17:54 +08:00
opengauss-bot a1c04c6c39
!2734 小型化版本删除共享存储
Merge pull request !2734 from 陈栋/lite
2023-01-03 14:39:42 +00:00
chendong76 cc44099d9e 小型化删除共享存储 2023-01-03 21:34:19 +08:00
opengauss-bot 26a5210b41
!2733 更新版本号至3.1.1
Merge pull request !2733 from 蒋宏博/master
2023-01-03 13:06:45 +00:00
jianghongbo4 a7f1f09950 更新版本号至3.1.1 2023-01-03 19:47:25 +08:00
WangXiuqiang ccd860bff7 解决update部分列无法选择正确分区的问题 2023-01-03 16:14:54 +08:00
lilong 1308658189 函数GetPartOidByATcmd内部枚举值PART_AREA_INTERVAL使用有误 2023-01-03 16:07:21 +08:00
teooooozhang 3b89a69792 data_directory指定目录与-D指定不一致时,gs_ctl start/stop启动问题修复 2023-01-03 15:57:17 +08:00
lilong c5a2b63704 函数_outNode内T_NoGPCHint分支缺少break语句 2023-01-03 15:18:11 +08:00
lilong 8d57f28cb1 函数CreateAlterTableCommandTag内AT_EncryptionKeyRotation分支缺少break语句 2023-01-03 15:08:54 +08:00
lilong 92de5dcb69 函数pgaudit_ProcessUtility内T_CreatePackageBodyStmt分支缺少break语句 2023-01-03 14:53:55 +08:00
lilong fabaac505c 函数GaussDbThreadMain内有些分支缺少break语句 2023-01-03 14:34:45 +08:00
zhaoheng.jiang 75639bc960 bugfix: extreme rto XLogReadBufferForRedoBlockExtend() parameter error 2023-01-03 14:31:43 +08:00
opengauss-bot aef96219b4
!2709 增加dbe_perf.file_iostat相关日志
Merge pull request !2709 from zhangao/master_lrulog
2023-01-03 06:22:00 +00:00
lilong d65919d4b9 函数VerifyDestDirIsEmptyOrCreate内case 0分支缺少break语句 2023-01-03 13:51:20 +08:00
ganyang 255c419497 add plannerHook 2023-01-03 11:54:40 +08:00
lilong d627bdff4e 函数getlen_stream中RESPONSE_DATAROW分支直接return后续代码无效 2023-01-03 11:12:31 +08:00
opengauss-bot f52b872535
!2713 函数HasNOTNULLConstraint内部打印格式控制字符有误
Merge pull request !2713 from foolishlee/master
2023-01-03 02:16:36 +00:00
z00793368 11b4e24959 add log 2022-12-31 11:57:51 +08:00
opengauss-bot 02f5afd2e0
!2712 修改issue: pg_resetxlog工具设置xlog文件名不正确
Merge pull request !2712 from zhaobingyu/zby_resetxlog
2022-12-30 09:14:31 +00:00
lilong ee3b7bcb4c 修正函数HasNOTNULLConstraint内部打印格式控制字符有误 2022-12-30 16:45:47 +08:00
zhaobingyu c843c345be 修改issue: pg_resetxlog工具设置xlog文件名不正确 2022-12-30 15:56:27 +08:00
opengauss-bot ea4f17cc42
!2708 修改issue:dss模式下pg_controldata数据目录输入错误报错不合理
Merge pull request !2708 from zhaobingyu/pg_controldata
2022-12-30 06:54:26 +00:00
opengauss-bot c1119fa4ac
!2694 解决dolphin插件中当采用div作为分区键时,会导致crash的问题
Merge pull request !2694 from 王修强/partition_div_key
2022-12-30 03:22:02 +00:00
opengauss-bot 7620f26d8a
!2706 修复列存子连接包含rownum和one time filter时找不到var的问题
Merge pull request !2706 from pengjiong/fix_date
2022-12-30 02:21:37 +00:00
zhaobingyu 8190bf4ae9 修改issue:dss模式下pg_controldata数据目录输入错误报错不合理 2022-12-30 09:28:26 +08:00
opengauss-bot a0fc99d621
!2677 修复pg_stat_replication存在race condition并且有可能造成宕机的问题
Merge pull request !2677 from wenger/fix_walsender_race_condition
2022-12-29 11:57:11 +00:00
totaj b2cac28597 Fix rownum with column table. 2022-12-29 17:16:36 +08:00
opengauss-bot 09b568993d
!2703 【轻量级 PR】:使用多进程初始化subscription check用例
Merge pull request !2703 from pengjiong/N/A
2022-12-29 08:59:49 +00:00
opengauss-bot 211c7d7e68
!2705 修复gs_probackup merge-expired功能不生效问题
Merge pull request !2705 from 吴岳川/master
2022-12-29 08:33:07 +00:00
wuyuechuan aef0b4dbaf bugfix: gs_probackup merge-expired does not teke effect 2022-12-29 14:21:17 +08:00
潘浩文 6dfbb15ab5 修复pg_stat_get_wal_sender产生的race condition问题 2022-12-29 12:21:49 +08:00
opengauss-bot c617e92d9b
!2704 【optimized】优化默认节点指针的内存分配
Merge pull request !2704 from laishenghao/palloc_optimize
2022-12-29 02:46:13 +00:00
WangXiuqiang 14d546cc39 增加测试用例 2022-12-29 09:27:55 +08:00
WangXiuqiang 33f90f64e6 解决dolphin插件中当采用div作为分区键时,会导致crash的问题 2022-12-29 09:23:00 +08:00
Laishenghao 12ad305548 【optimized】优化默认节点指针的内存分配 2022-12-28 20:38:50 +08:00
pengjiong 5774e2ff85
Use multiprocess for subscription check.
Signed-off-by: pengjiong <totaj@qq.com>
2022-12-28 12:38:35 +00:00
opengauss-bot ec5bd2ce9d
!2610 解决分区键表达式不支持extract和year函数
Merge pull request !2610 from 王修强/partition_key_issue
2022-12-28 11:38:22 +00:00
opengauss-bot 7ed23d0b31
!2695 修复列顺序不一致时基础数据复制失败的问题&&增加发布订阅用例
Merge pull request !2695 from chenxiaobin/pubsubcheck
2022-12-28 06:20:02 +00:00
opengauss-bot 3141e7839e
!2701 解决问题:pg_xlogdump命令执行失败
Merge pull request !2701 from zhaobingyu/master
2022-12-28 01:09:58 +00:00
opengauss-bot c68e1a37ed
!2698 【共享存储】 去掉aio过程中的主动panic
Merge pull request !2698 from 陈婷婷/master
2022-12-28 00:55:52 +00:00
opengauss-bot 708502e97d
!2692 修复并行查询下agg语句执行结果不一致的问题
Merge pull request !2692 from chenxiaobin/fixAgg
2022-12-27 11:11:10 +00:00
zhaobingyu 547d64b3a8 修改问题:pg_xlogdump命令执行失败 2022-12-27 19:07:41 +08:00
chentingting 9a1511fa4c 【共享存储】 去掉aio过程中的主动panic 2022-12-27 18:24:33 +08:00
chenxiaobin19 785a596df1 agg cannot contain set-returning function calls 2022-12-27 17:57:24 +08:00
chenbd 7a4ed428c2 修复psql 和B模式的delimiter 冲突的问题 2022-12-27 04:13:50 -05:00
opengauss-bot fc654ee8e5
!2697 解决问题:pg_resetxlog工具在普通数据库下执行失败
Merge pull request !2697 from zhaobingyu/master
2022-12-27 08:42:21 +00:00
zhaobingyu 315b44113c 解决问题: pg_resetxlog工具在普通数据库下执行失败 2022-12-27 15:23:53 +08:00
chenxiaobin19 5927d3111a fix table sync with different column order && add testcase for subscription 2022-12-27 11:38:34 +08:00
opengauss-bot 7ff965f389
!2686 修复CREATE MODEL指定不存在的算法时导致core的问题
Merge pull request !2686 from Cross-罗/algo_core
2022-12-26 06:33:34 +00:00
luo_zihao5524 7d96b40168 修复CREATE MODEL指定不存在的算法时导致core的问题 2022-12-26 10:05:00 +08:00
opengauss-bot 1dc6f1f812
!2685 防止arm操作系统由于调度算法的问题导致xlog follower等待被分配太多CPU的问题
Merge pull request !2685 from 吴岳川/master
2022-12-26 01:46:10 +00:00
opengauss-bot ef6a53180d
!2637 [共享存储]回退规避主备页面异常的代码, 回退rebuild中跳过旧页面的rebuild逻辑
Merge pull request !2637 from cchen676/1207master
2022-12-24 09:14:42 +00:00
arcoalien@qq.com e65c837077 [共享存储]回退规避主备页面异常的代码, 回退rebuild中跳过旧页面的rebuild逻辑 2022-12-24 16:15:46 +08:00
wuyuechuan 0651593f81 solve the xlog cpu cost too much for yeild waiting 2022-12-24 15:35:33 +08:00
opengauss-bot 569e6cc149
!2680 重载依赖RelFileNode作为HashKey的hash函数和match函数,使其计算时不再考虑opt的属性值。
Merge pull request !2680 from 吴岳川/copt
2022-12-24 06:19:07 +00:00
opengauss-bot b958f950bf
!2292 执行UNION all 语句,其中多个子查询带有NULL目标列时报错
Merge pull request !2292 from HYH/20221010_117754_union_null_310master
2022-12-24 03:39:05 +00:00
opengauss-bot baa013bfe1
!2682 【共享存储】解决页面版本校验强制将全0页刷盘引入的性能问题,该校验功能只在DEBUG版本调测使用
Merge pull request !2682 from peibaoyi/master
2022-12-24 02:13:17 +00:00
opengauss-bot c72e49f563
!2678 【共享存储】临时规避在备机创建文件等场景下DSS不支持带来的问题
Merge pull request !2678 from 董宁/open_fix2_up
2022-12-23 12:51:15 +00:00
opengauss-bot 99e4f7ff09
!2670 禁止在dolphin插件存在时删除public模式
Merge pull request !2670 from 仲夏十三/public
2022-12-23 10:07:57 +00:00
huyinghao d2d86be171 去除空行 2022-12-23 16:50:28 +08:00
huyinghao a5fb68a3a2 在transformSetOperationTree遍历左右子树后,不立即对目标列类型进行处理,而是将targetlist缓存下来,待整棵树遍历完成后,将所有的targetlist汇总,此时每列从对应多个子查询的列类型选出一个合适类型,然后再递归遍历SetOperationStmt,处理每个节点的类型等操作,此时如果节点左右子节点某列类型为NULL,则使用选择出来的类型
回退所有针对union的修改

修改使允许两列 值为NULL且类型未知union操作后 产生的text类型目标列 可以与其它任意类型的列进行union或union all操作

增加文件末尾行

将添加在末尾的fastcheck用例往上移,避免合并冲突

修改 copy/equal/out/readfuncs.cpp

增加版本控制
2022-12-23 16:42:41 +08:00
peibaoyi 3b4ed0988d 解决页面版本校验强制将全0页刷盘引入的性能问题,该校验功能只在DEBUG版本调测使用 2022-12-23 15:08:26 +08:00
chenxiaobin19 b79da29a94 ignore opt field when computing hash value 2022-12-23 15:07:07 +08:00
nnuanyang 8c80ce6dd8 error message 2022-12-22 23:00:57 -08:00
opengauss-bot c4ea9be231
!2676 支持or表达式的谓词提取下推
Merge pull request !2676 from 陈志凯/master
2022-12-23 06:47:32 +00:00
opengauss-bot 95f017db04
!2674 [Bugfix] 解决CreateTableAs无法在备机转发的问题
Merge pull request !2674 from 周斌/skip_readonly
2022-12-23 06:35:16 +00:00
justbk 16bed4d95b repair create table as /insert into/ select into bug. 2022-12-23 12:19:53 +08:00
ganyang 63f962adb7 prevent drop schema public for dolphin 2022-12-23 10:27:33 +08:00
dongning12 7278436817 [共享存储] avoid core when standby node create file failed 2022-12-23 09:50:54 +08:00
opengauss-bot 152c407512
!2675 【轻量级 PR】:修复删除数据库后,backend id被复用导致的lsc资源清理时的core问题
Merge pull request !2675 from pengjiong/N/A
2022-12-23 01:34:47 +00:00
opengauss-bot 88575eae03
!2672 【共享存储】DEBUG版本增加页面版本LSN校验能力
Merge pull request !2672 from peibaoyi/master
2022-12-22 12:40:26 +00:00
chenzhikai b15c245a18 支持or表达式的谓词提取下推,为sql_bate_feature新增选项来控制这个功能 2022-12-22 18:49:41 +08:00
opengauss-bot 5d56e686e6
!2664 【轻量级 PR】:修复加载dolphin插件场景下,重启导致的死锁问题
Merge pull request !2664 from pengjiong/N/A
2022-12-22 08:17:10 +00:00
pengjiong 1b6bf1b848
Fix core when exit thread
Signed-off-by: pengjiong <totaj@qq.com>
2022-12-22 08:10:09 +00:00
peibaoyi 412ef0a1af 【共享存储】1. 增加页面版本校验,拦截页面版本错乱第一现场 2. 共享存储最大连接数限制为16000 2022-12-22 15:54:06 +08:00
opengauss-bot 1b97274b24
!2441 支持容器化升级
Merge pull request !2441 from 薛蒙恩/docker_upgrade
2022-12-22 06:28:12 +00:00
opengauss-bot 7924440a6d
!2641 修复WLM线程在内存不足时可能卡在PGconnectdb过程中阻塞数据库关闭
Merge pull request !2641 from kenxx/my_master
2022-12-21 11:18:06 +00:00
opengauss-bot 91d9ef5e12
!2656 修复siblings by+limit报错的问题
Merge pull request !2656 from chenxiaobin/SWCB_limit
2022-12-21 06:21:32 +00:00
opengauss-bot d58ebf08df
!2662 修复升级hdfs_fdw创建失败问题
Merge pull request !2662 from 杨皓/master
2022-12-21 06:15:11 +00:00
pengjiong 21d6ae2954
Fix core when connect new B db.
Signed-off-by: pengjiong <totaj@qq.com>
2022-12-21 01:55:15 +00:00
yanghao cc86d9efb9 fix problem for hdfs_fdw in upgrade 2022-12-20 19:12:37 +08:00
kenxx a411cc302f 设置ImmediateInterruptOK确保WLM线程在PQconnect无响应时也能正常被关闭 2022-12-20 16:35:19 +08:00
opengauss-bot 05a98eccc2
!2655 修复gs_dump导出大小写敏感自增列的问题
Merge pull request !2655 from 李居东/fixbug
2022-12-20 08:26:39 +00:00
chenxiaobin19 f6483f4369 support siblings by + limit 2022-12-20 15:31:24 +08:00
dongning12 b79274bcc5 [共享存储] set standby as default when db start 2022-12-20 15:15:59 +08:00
li-judong 9b59521509 修复gs_dump支持导出大小写敏感自增列的问题 2022-12-20 14:20:09 +08:00
opengauss-bot dfc46c5916
!2156 修复create package中报错位置不准确的问题。
Merge pull request !2156 from dongxu.wei/fix_create_pkg_error_pos
2022-12-20 06:05:15 +00:00
opengauss-bot c950de5f36
!2646 [Bugfix] 解决超长SQL语句开启libpqsw模块日志输出时报错的问题
Merge pull request !2646 from 周斌/multi-write-print
2022-12-20 02:42:39 +00:00
opengauss-bot cd613855bf
!2526 解决ceil()函数内部嵌套函数tan()结果为-0问题
Merge pull request !2526 from Ruixiang Li/ceilSolve
2022-12-20 02:03:18 +00:00
opengauss-bot 15ac32a9c7
!2649 修复gsql没有适配0列数据的问题
Merge pull request !2649 from pengjiong/fix_date
2022-12-20 01:38:22 +00:00
WangXiuqiang 1a417078d1 解决分区键表达式不支持extract和year函数 2022-12-20 09:26:24 +08:00
opengauss-bot d8efa2c50f
!2643 【共享存储】【bugfix】修复CBConfirmCoverting出现core
Merge pull request !2643 from 董宁/master
2022-12-19 12:20:26 +00:00
liruixiang 5c29e59612 解决ceil函数嵌套tan函数可能返回-0的问题 2022-12-19 16:07:02 +08:00
opengauss-bot f6cd9da230
!2616 修复AUTO_INCREMENT自增列约束问题,gs_dump支持导出自增列索引
Merge pull request !2616 from 李居东/fixbug
2022-12-19 07:33:09 +00:00
totaj 84a4884373 Fix empty column. 2022-12-19 14:40:50 +08:00
opengauss-bot a28e49918d
!2640 资源池化适配pg_resetxlog工具
Merge pull request !2640 from zhaobingyu/zby_resetxlog_pro
2022-12-19 01:53:34 +00:00
opengauss-bot 05d7b74e31
!2642 fix SlruPhysicalReadPage beyond file size read
Merge pull request !2642 from 陈婷婷/master
2022-12-18 01:10:20 +00:00
justbk c98b1f6299 remove check vsprintf in standy write 2022-12-17 19:37:30 +08:00
opengauss-bot e989a7c515
!2645 [Bugfix] repair Q message unexcept transfer
Merge pull request !2645 from 周斌/multi-write-redirect
2022-12-17 11:37:07 +00:00
justbk 2b59dba0e9 repair Q message unclear redirect flag issue 2022-12-17 14:42:31 +08:00
opengauss-bot aaaddb18a5
!2543 tidscan算子扫描分区表,在ExecInit时,没有处理PBE裁剪,导致只扫描了第一个分区。
Merge pull request !2543 from playrest/master-commit-1
2022-12-16 13:22:36 +00:00
opengauss-bot c3eb405592
!2597 修复replace into在explain语句中的问题
Merge pull request !2597 from zong/master
2022-12-16 13:20:23 +00:00
opengauss-bot 9d9fd46e69
!2639 适配dms修改drc版本号判断逻辑
Merge pull request !2639 from 胡习林/master
2022-12-16 10:56:54 +00:00
opengauss-bot baca9249e1
!2630 层次函数嵌套聚集函数报错问题
Merge pull request !2630 from 陈志凯/master
2022-12-16 09:30:55 +00:00
chentingting 4ddebd5c2d fix SlruPhysicalReadPage beyond file size read 2022-12-16 16:52:01 +08:00
dongning12 2f9e6e1fe4 [共享存储]修复CBConfirmConverting出现core 2022-12-16 16:30:32 +08:00
opengauss-bot e73020e2b7
!2627 修复record类型中定义的not null约束未生效的问题
Merge pull request !2627 from chenxiaobin/recordNotNUll
2022-12-16 08:07:40 +00:00
chenxiaobin19 8b19fc7972 fix not null constraint of record unaffective bug 2022-12-16 15:04:20 +08:00
opengauss-bot 1d11fc5ba2
!2619 修复autocommit关闭后错误语句在事务块处理错误的问题
Merge pull request !2619 from Cross-罗/autocommit
2022-12-16 07:03:29 +00:00
opengauss-bot 0ccdf5dd95
!2454 移除AlignMemoryAllocator::AllocSetDelete内无用的加锁操作
Merge pull request !2454 from 胡正超/memlock
2022-12-16 06:28:50 +00:00
opengauss-bot 2d767f5756
!2625 修复2.0.0升级3.0.1版本,升级报错问题
Merge pull request !2625 from 杨皓/master
2022-12-16 03:21:21 +00:00
opengauss-bot deedcc4bdd
!2624 【bugfixed】解决由于空指针导致的1.1.0升级到3.1.0后对外键表进行delete操作产生core的问题
Merge pull request !2624 from laishenghao/110up310
2022-12-16 03:16:28 +00:00
hu 689c0d8783 适配dms修改drc 版本号判断机制 2022-12-16 10:53:59 +08:00
zhaobingyu 7d95ebaf34 资源池化适配pg_resetxlog工具,解决:1、数据库开启但是重置日志成功问题,2、修改使用方法,无需用户输入节点id,工具自动识别主节点id并对主节点xlog日志进行重置 2022-12-16 10:08:37 +08:00
opengauss-bot 6bc9c3930b
!2618 Remove DBMind from openGauss-server repository
Merge pull request !2618 from wangtq/master
2022-12-15 12:03:59 +00:00
opengauss-bot 7b2c39af14
!2636 Upgrade scripts for MOT new features
Merge pull request !2636 from Vinoth Veeraraghavan/master
2022-12-15 11:37:08 +00:00
li-judong 6fe074f4a1 修复自增列约束问题,gs_dump支持导出自增列索引 2022-12-15 16:29:04 +08:00
chenzhikai 36bfa3239a start with 2022-12-15 16:24:39 +08:00
opengauss-bot 95321a2a6e
!2629 增加语法解析阶段bison的默认栈大小
Merge pull request !2629 from pengjiong/fix_date
2022-12-15 08:08:00 +00:00
openGaussDev eaa6361795 Added upgradesql scripts for MOT JIT new features
Offering: openGaussDev

More detail: Added upgradesql scripts for MOT JIT new features

Signed-off-by: Vinoth Veeraraghavan <vinoth.veeraraghavan@huawei.com>

Match-id-95427ae16c5ac4a70351c13ce98028270c2ac5bc
2022-12-15 16:06:29 +08:00
opengauss-bot dfca92aebe
!2621 【共享存储】修复reform和正常运行期间获取CSN集群hang
Merge pull request !2621 from 刘博文/master
2022-12-15 08:00:15 +00:00
opengauss-bot afc29ca14d
!2598 修复基于外表的视图更新的check option不生效的问题
Merge pull request !2598 from chenxiaobin/fixFdwCheckOption
2022-12-15 03:48:59 +00:00
bowenliu e1da7bcc48 fix switchover hang during getting CSN 2022-12-15 10:29:32 +08:00
opengauss-bot adc8364212
!2632 修改issue -- 指定-O参数执行pg_resetxlog命令失败,产生core文件
Merge pull request !2632 from zhaobingyu/master
2022-12-15 02:27:33 +00:00
opengauss-bot b52a75d25a
!2607 修复switchover -f不生效问题
Merge pull request !2607 from 熊小军/master
2022-12-15 01:40:32 +00:00
opengauss-bot 1ec89d5a2c
!2635 【共享存储】dss_contrl.sh适配扫描盘符的能力
Merge pull request !2635 from zhaodu/master
2022-12-15 01:20:05 +00:00
opengauss-bot 0238d80fee
!2631 适配ss门禁
Merge pull request !2631 from 刘恒/master
2022-12-14 15:43:10 +00:00
opengauss-bot d611aaa7f3
!2633 [Bugfix] repair unexcept log output
Merge pull request !2633 from 周斌/mw_bugfix
2022-12-14 13:55:11 +00:00
zhaodu 092f458655 【共享存储】dss_contrl.sh适配扫描盘符的能力 2022-12-14 21:07:58 +08:00
justbk 3787c02557 add log_enable logic and avoid psrc is NULL 2022-12-14 20:48:18 +08:00
luozihao 9318cd8b1f 修复错误语句处理不一致的问题 2022-12-14 19:35:00 +08:00
chenxiaobin19 9cee00b918 fix with check option on views referencing postgres_fdw tables 2022-12-14 19:32:41 +08:00
opengauss-bot a8dd3ece1f
!2613 [共享存储]update gaussdb.state after reform finish
Merge pull request !2613 from zhengxue/master_dev
2022-12-14 11:30:50 +00:00
zhaobingyu 183a62fe66 修改issue -- 指定-O参数执行pg_resetxlog命令失败,产生core文件 2022-12-14 18:15:10 +08:00
liuheng 9efa654873 适配ss门禁 2022-12-14 18:12:19 +08:00
opengauss-bot 5a43e77784
!2542 解决问题:全密态密钥删除失败
Merge pull request !2542 from lorand/master
2022-12-14 09:44:36 +00:00
opengauss-bot 529d6f2dd6
!2617 [共享存储] 修复dms port超过32767时dn启动失败问题
Merge pull request !2617 from 陈婷婷/master
2022-12-14 09:35:16 +00:00
totaj 417e617fee Increase default bison stack. 2022-12-14 17:28:33 +08:00
wangtq c804e82b84 feat: modify makefile to avoid copying dbmind 2022-12-14 17:07:09 +08:00
yanghao 1fab996fc4 fix problem that upgrade rollback failed 2022-12-14 16:13:17 +08:00
opengauss-bot 5d4ad6ccea
!2614 【问题】server仓primary key和unique适配index_option
Merge pull request !2614 from yuhuanhuan/demand_set
2022-12-14 07:02:07 +00:00
opengauss-bot 6a35d51d42
!2615 support changing schema of foreign table(not mot)
Merge pull request !2615 from 吴岳川/master
2022-12-14 06:50:47 +00:00
wuyuechuan 6289b1965d support changing schema of foreign table(not mot) 2022-12-14 14:37:21 +08:00
opengauss-bot 3de7b7709f
!2623 Fix to restore MOT JIT context properly on error
Merge pull request !2623 from Vinoth Veeraraghavan/master
2022-12-14 04:10:29 +00:00
opengauss-bot 29793c51c1
!2603 issue修复:float4/float8类型列使用ignore hint插入空字符串失败修复
Merge pull request !2603 from zhangzhixian/ignore_empty_string_input
2022-12-14 03:53:42 +00:00
opengauss-bot 059ad05d7b
!2622 修复内存溢出,cmake编译失败问题
Merge pull request !2622 from zhangao/master_dev3
2022-12-14 03:08:11 +00:00
Vinoth Veeraraghavan 6c87699fa9 Minor bug fix to setup/restore jit_context in MOT JIT 2022-12-14 10:12:10 +08:00
opengauss-bot 25eba6cc8e
!2609 禁止手动删除列存分区的delta/cudesc表
Merge pull request !2609 from chen/partition
2022-12-14 01:08:22 +00:00
suncan a9ccc5de65 【】server仓主键,唯一键适配index_option 2022-12-13 20:56:17 +08:00
opengauss-bot 54d0336182
!2611 【共享存储】解决解决主备倒换时,clog文件在DSS层未扩展到16M大小,导致StartupXLog时读取相关偏移时报seek offset失败
Merge pull request !2611 from peibaoyi/master
2022-12-13 12:41:23 +00:00
opengauss-bot 54c43934af
!2563 资源池化适配 pg_resetxlog 工具
Merge pull request !2563 from zhaobingyu/zby_resetxlog2
2022-12-13 12:02:27 +00:00
opengauss-bot 79c1558523
!2529 [feature] 支持多节点写入特性
Merge pull request !2529 from 周斌/multi-write
2022-12-13 12:02:14 +00:00
shirley_zhengx 4b98847600 [共享存储]update gaussdb.state after reform finish 2022-12-13 19:27:31 +08:00
gentle_hu 041e899d78 remove unused lock in private AlignMemoryAllocator 2022-12-13 19:20:49 +08:00
wangtq d951407620 maintain: seperate DBMind from openGauss-server 2022-12-13 19:11:19 +08:00
zhaobingyu 97bc7cd191 资源池化适配 pg_resetxlog 工具 2022-12-13 18:36:16 +08:00
chentingting 0d516a27d1 [共享存储] 修复dms port超过32767时dn启动失败问题 2022-12-13 16:45:07 +08:00
justbk 1a4ec792e8 support multi standby write feature 2022-12-13 16:39:18 +08:00
teooooozhang ecf954899d issue修复:float4/float8类型列使用ignore插入空字符串失败修复 2022-12-13 15:28:03 +08:00
opengauss-bot 6412f131ab
!2486 修复gsql、gaussdb、gs_basebackup、gs_loader、gs_dump、gstrace等工具端口号为空或者错误时的回显提示
Merge pull request !2486 from Ruixiang Li/master
2022-12-13 07:12:24 +00:00
z00793368 2ac8c7df7c 修复赋值内存溢出问题 2022-12-13 11:17:45 +08:00
peibaoyi 8dca586a5a fix pg_clog issue where read page beyond the file size (less than one segment size) 2022-12-12 23:17:57 +08:00
chen 6513ff0aae
forbid drop partition delta/cudesc table
Signed-off-by: chen <chenbobo3@huawei.com>
2022-12-12 12:50:29 +00:00
xiong_xjun 1b4021b43d extremely fast switchover 2022-12-12 18:04:51 +08:00
laishenghao f08b471229 解决由于空指针导致的1.1.0升级到3.1.0后对外键表进行delete操作产生core 2022-12-12 17:01:53 +08:00
liruixiang 17bb950da8 修复gsql、gaussdb、gs_basebackup、gs_loader、gs_dump、gstrace等工具端口号为空或者错误时的回显提示 2022-12-10 20:01:11 +08:00
zongwei c12a8681ca fix the bug when replace into using in explain statement 2022-12-09 02:06:52 -05:00
lorand 13606147e4
cleancode 2022-12-08 08:46:23 +00:00
xhy 5367ca6737 tidscan算子扫描分区表,在ExecInit时,没有处理PBE裁剪,导致只扫描了第一个分区。 2022-12-05 18:06:09 +08:00
lorand f8ec465f1f
FixBug if search path contain whitespace, fail to remove key file when use “drop client master key” 2022-12-05 09:18:27 +00:00
qianxue21 9695ccd722 修复label名截断问题 2022-11-30 09:14:03 +08:00
dongxu.wei 71755991b2 修复create package中报错位置不准确的问题。
修复方案在CreatePackageStmt中添加了pkgspec_location和pkgspec_prefix_len成员变量,用于保存package body的位置和添加的SQL的长度,报错时重新计算报错编译位置。
2022-09-13 17:00:43 +08:00
dongxu.wei ab3d6c1bb1 修复drop netst table of type后再创建同名domain,创建pacakge使用该字段coredump的问题。 2022-09-13 09:40:33 +08:00
unknown 7bb9a3d35b 支持容器化升级 2022-08-16 11:40:29 +08:00
1815 changed files with 132890 additions and 85215 deletions

View File

@ -16,7 +16,8 @@
1. 请附上自验结果(内容或者截图)
2. 是否可以添加fastcheck测试用例如是请补充fastcheck用例
3. 是否涉及资料修改如是在docs仓库补充资料
4. 是否考虑支撑升级和在线扩容等扩展场景
4. 是否考虑升级场景(系统表修改、日志持久化以及修改执行态数据格式)
5. 是否考虑在线扩容等扩展场景
5. 是否考虑异常场景/并发场景/前向兼容/性能场景
6. 是否对其他模块产生影响

24
.gitmodules vendored Normal file
View File

@ -0,0 +1,24 @@
[submodule "openGauss-Custom-function"]
path = openGauss-Custom-function
url = ../openGauss-Custom-function.git
[submodule "openGauss-Query-select"]
path = openGauss-Query-select
url = ../openGauss-Query-select.git
[submodule "openGauss-Security-control"]
path = openGauss-Security-control
url = ../openGauss-Security-control.git
[submodule "openGauss-Stored-Procedure"]
path = openGauss-Stored-Procedure
url = ../openGauss-Stored-Procedure.git
[submodule "openGauss-basic-operation"]
path = openGauss-basic-operation
url = ../openGauss-basic-operation.git
[submodule "openGauss-transaction"]
path = openGauss-transaction
url = ../openGauss-transaction.git
[submodule "openGauss-trigger"]
path = openGauss-trigger
url = ../openGauss-trigger.git
[submodule "openGauss-competition"]
path = openGauss-competition
url = ../openGauss-competition.git

View File

@ -93,6 +93,7 @@ install:
$(MAKE) install_pldebugger
$(MAKE) -C contrib/postgres_fdw $@
$(MAKE) -C contrib/hstore $@
$(MAKE) -C contrib/dblink $@
@if test -d contrib/dolphin; then $(MAKE) -C contrib/dolphin $@; fi
+@echo "openGauss installation complete."
endif

View File

@ -414,6 +414,8 @@ https://opengauss.org/zh/
| 2.1.0 | https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.1.0/openGauss-third_party_binarylibs.tar.gz |
| 3.0.0 | https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.0.0/openGauss-third_party_binarylibs.tar.gz |
| 3.1.0 | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
| 3.1.1 | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.1/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.1/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.1/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
| 5.0.0 | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/5.0.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
| master | **openEuler_arm:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz <br/> **openEuler_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz<br/> **Centos_x86:** https://opengauss.obs.cn-south-1.myhuaweicloud.com/latest/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz |
现在我们已经拥有完整的openGauss代码把它存储在以下目录中以sda为例

View File

@ -904,4 +904,4 @@
./include/pqcomm.h
./include/pqexpbuffer.h
[version]
3.1.0
5.0.0

View File

@ -40,7 +40,6 @@
./bin/kadmin.local
./bin/lz4
./bin/kadmind
./bin/dbmind
./bin/gs_dbmind
./bin/constant
./bin/server.key.cipher
@ -84,6 +83,9 @@
./share/postgresql/extension/mot_fdw.control
./share/postgresql/extension/postgres_fdw--1.0.sql
./share/postgresql/extension/postgres_fdw.control
./share/postgresql/extension/dblink--1.0.sql
./share/postgresql/extension/dblink--unpackaged--1.0.sql
./share/postgresql/extension/dblink.control
./share/postgresql/timezone/GB-Eire
./share/postgresql/timezone/Turkey
./share/postgresql/timezone/Kwajalein
@ -758,6 +760,7 @@
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/postgresql/dblink.so
./lib/postgresql/pgoutput.so
./lib/libpljava.so
./lib/libpq.a
@ -832,6 +835,7 @@
./lib/libpagecompression.so*
./lib/libdssapi.so
./lib/libdms.so
./lib/libodbc.so*
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h

View File

@ -442,6 +442,7 @@ function install_gaussdb()
export BUILD_TUPLE=${PLATFORM_ARCH}
export THIRD_BIN_PATH="${binarylibs_path}"
export PREFIX_HOME="${BUILD_DIR}"
export ENABLE_LITE_MODE=ON
if [ "$version_mode"x == "release"x ]; then
CMAKE_OPT="-DENABLE_MULTIPLE_NODES=OFF -DENABLE_PRIVATEGAUSS=OFF -DENABLE_THREAD_SAFETY=ON -DENABLE_LITE_MODE=ON"
@ -454,6 +455,10 @@ function install_gaussdb()
export DEBUG_TYPE=debug
fi
if [[ -e "/etc/openEuler-release" && "$(cat /etc/openEuler-release | awk '{print $3}')" == "22.03" ]]; then
CMAKE_OPT="$CMAKE_OPT -DENABLE_OPENEULER_MAJOR=ON"
fi
echo "CMAKE_OPT----> $CMAKE_OPT"
echo "Begin run cmake for gaussdb server" >> "$LOG_FILE" 2>&1
echo "CMake options: ${CMAKE_OPT}" >> "$LOG_FILE" 2>&1
echo "CMake release: ${DEBUG_TYPE}" >> "$LOG_FILE" 2>&1

View File

@ -1,2 +1,2 @@
PRODUCT=openGauss
VERSION=3.1.0
VERSION=5.0.0

View File

@ -38,7 +38,6 @@
./bin/kadmin.local
./bin/lz4
./bin/kadmind
./bin/dbmind
./bin/server.key.cipher
./bin/server.key.rand
./etc/kerberos/kadm5.acl
@ -80,6 +79,9 @@
./share/postgresql/extension/gsredistribute--unpackaged--1.0.sql
./share/postgresql/extension/postgres_fdw--1.0.sql
./share/postgresql/extension/postgres_fdw.control
./share/postgresql/extension/dblink--1.0.sql
./share/postgresql/extension/dblink--unpackaged--1.0.sql
./share/postgresql/extension/dblink.control
./share/postgresql/timezone/GB-Eire
./share/postgresql/timezone/Turkey
./share/postgresql/timezone/Kwajalein
@ -753,6 +755,7 @@
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/postgresql/dblink.so
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
@ -881,6 +884,7 @@
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/libhll.so
./lib/libodbc.so*
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h

View File

@ -37,7 +37,7 @@
./bin/kadmin.local
./bin/lz4
./bin/kadmind
./bin/dbmind
./bin/gs_dbmind
./bin/server.key.cipher
./bin/server.key.rand
./bin/gs_plan_simulator.sh
@ -82,6 +82,9 @@
./share/postgresql/extension/gsredistribute--unpackaged--1.0.sql
./share/postgresql/extension/postgres_fdw--1.0.sql
./share/postgresql/extension/postgres_fdw.control
./share/postgresql/extension/dblink--1.0.sql
./share/postgresql/extension/dblink--unpackaged--1.0.sql
./share/postgresql/extension/dblink.control
./share/postgresql/timezone/GB-Eire
./share/postgresql/timezone/Turkey
./share/postgresql/timezone/Kwajalein
@ -755,6 +758,7 @@
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/postgresql/dblink.so
./lib/libpljava.so
./lib/libpq.a
./lib/libpq.so
@ -883,6 +887,7 @@
./lib/postgresql/latin2_and_win1250.so
./lib/postgresql/euc2004_sjis2004.so
./lib/libhll.so
./lib/libodbc.so*
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h

View File

@ -903,4 +903,4 @@
./include/pqcomm.h
./include/pqexpbuffer.h
[version]
3.1.0
5.0.0

View File

@ -40,7 +40,6 @@
./bin/kadmin.local
./bin/lz4
./bin/kadmind
./bin/dbmind
./bin/gs_dbmind
./bin/constant
./bin/server.key.cipher
@ -84,6 +83,9 @@
./share/postgresql/extension/mot_fdw.control
./share/postgresql/extension/postgres_fdw--1.0.sql
./share/postgresql/extension/postgres_fdw.control
./share/postgresql/extension/dblink--1.0.sql
./share/postgresql/extension/dblink--unpackaged--1.0.sql
./share/postgresql/extension/dblink.control
./share/postgresql/timezone/GB-Eire
./share/postgresql/timezone/Turkey
./share/postgresql/timezone/Kwajalein
@ -758,6 +760,7 @@
./lib/postgresql/pg_upgrade_support.so
./lib/postgresql/java/pljava.jar
./lib/postgresql/postgres_fdw.so
./lib/postgresql/dblink.so
./lib/postgresql/pgoutput.so
./lib/libpljava.so
./lib/libpq.a
@ -829,6 +832,7 @@
./lib/libpagecompression.so*
./lib/libdssapi.so
./lib/libdms.so
./lib/libodbc.so*
./include/postgresql/server/postgres_ext.h
./include/postgresql/server/pg_config_os.h

View File

@ -198,7 +198,7 @@ ENDMACRO(CHECK_CC_ENABLE)
function(GET_VERSIONSTR_FROMGIT ret)
set(PG_VERSION "9.2.4")
set(OPENGAUSS_VERSION "3.1.0")
set(OPENGAUSS_VERSION "5.0.0")
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/${openGauss}/cmake/src/buildfunction.sh --s ${PROJECT_TRUNK_DIR} OUTPUT_VARIABLE GS_VERSION_STR)
set(PG_VERSION "${PG_VERSION}" PARENT_SCOPE)

View File

@ -74,7 +74,7 @@ option(USE_BONJOUR "enable bonjour, the old is --with-bonjour" OFF)
option(USE_LDAP "build with ldap, the old is --with-ldap" OFF)#ON
option(USE_ETCD "build with etcd libs, new option for old mppdb, after 8.1 close it" OFF)
option(USE_PROTOBUF "build with with protobuf's libs, we must need it" ON)
option(USE_LIBXML "build with libxml, the old is --with-libxml" OFF)
option(USE_LIBXML "build with libxml, the old is --with-libxml" ON)
option(HAVE_LIBXML2 "build with libxml2, the old is --with-libxml2" OFF)
option(USE_LIBXSLT "build with libxslt, the old is --with-libxslt" OFF)
option(USE_PAM "build with pam, the old is --with-pam" OFF)
@ -94,6 +94,7 @@ option(HAVE_LIBM "enable -lm, this set to default -lm" ON)
option(HAVE_POSIX_SIGNALS "enable posix signals, this set to default" ON)
option(HAVE_GCC_INT_ATOMICS "enable gcc buildin atomics operations, this set to default" ON)
option(FLEXIBLE_ARRAY_MEMBER "pq_ce need" ON)
option(ENABLE_OPENEULER_MAJOR "support openEuler 22.03 LTS, this set to default" OFF)
# we will differ compile flags and definitions by different vars
set(DB_COMMON_DEFINE "")
@ -139,23 +140,28 @@ if(${ENABLE_LITE_MODE} STREQUAL "ON")
set(ENABLE_LLVM_COMPILE OFF)
set(ENABLE_GSS OFF)
set(KRB5 OFF)
set(USE_LIBXML OFF)
endif()
if(${ENABLE_OPENEULER_MAJOR} STREQUAL "ON")
add_definitions(-DOPENEULER_MAJOR)
endif()
set(PROTECT_OPTIONS -fwrapv -std=c++14 -fnon-call-exceptions ${OPTIMIZE_LEVEL})
set(WARNING_OPTIONS -Wall -Wendif-labels -Werror -Wformat-security)
set(WARNING_OPTIONS -Wall -Wendif-labels -Wformat-security)
set(OPTIMIZE_OPTIONS -pipe -pthread -fno-aggressive-loop-optimizations -fno-expensive-optimizations -fno-omit-frame-pointer -fno-strict-aliasing -freg-struct-return)
set(CHECK_OPTIONS -Wmissing-format-attribute -Wno-attributes -Wno-unused-but-set-variable -Wno-write-strings -Wpointer-arith)
set(MACRO_OPTIONS -D_GLIBCXX_USE_CXX11_ABI=0 -DENABLE_GSTRACE -D_GNU_SOURCE -DPGXC -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DSTREAMPLAN -D_THREAD_SAFE ${DB_COMMON_DEFINE})
# Set MAX_ALLOC_SEGNUM size in extreme_rto
if(${WAL_SEGSIZE} LESS 512)
if(${WAL_SEGSIZE} LESS 256)
set(MAX_ALLOC_SEGNUM 4)
elseif(${WAL_SEGSIZE} GREATER_EQUAL 512 AND ${WAL_SEGSIZE} LESS 1024)
elseif(${WAL_SEGSIZE} GREATER_EQUAL 256 AND ${WAL_SEGSIZE} LESS 512)
set(MAX_ALLOC_SEGNUM 2)
elseif(${WAL_SEGSIZE} GREATER_EQUAL 1024)
elseif(${WAL_SEGSIZE} GREATER_EQUAL 512)
set(MAX_ALLOC_SEGNUM 1)
else()
message(FATAL_ERROR "error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024.")
message(FATAL_ERROR "error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512.")
endif()
# libraries need secure options during compling
@ -225,6 +231,7 @@ if(${USE_LIBXML})
else()
set(LIBS "${LIBS} -lxml")
set(GAUSSDB_CONFIGURE "${GAUSSDB_CONFIGURE} -DUSE_LIBXML")
set(CMAKE_CXX_FLAGS -l:liblzma.so.5)
endif()
endif()

View File

@ -116,6 +116,9 @@ function get_gs_version()
debug_str="$DEBUG_TYPE"
product=$(cat build/script/gaussdb.ver | grep 'PRODUCT' | awk -F "=" '{print $2}')
version=$(cat build/script/gaussdb.ver | grep 'VERSION' | awk -F "=" '{print $2}')
if [ "${ENABLE_LITE_MODE}" == "ON" ]; then
product="$product-lite"
fi
if test "$enable_ccache" = yes; then
default_gs_version="(${product} ${version} build 1f1f1f1f) compiled at 2100-00-00 00:00:00 commit 9999 last mr 9999 debug"
else

View File

@ -714,7 +714,7 @@
#define PGXC_VERSION_NUM
/* openGauss version as a number string */
#define OPENGAUSS_VERSION_NUM_STR "3.1.0"
#define OPENGAUSS_VERSION_NUM_STR "5.0.0"
/* A string containing the version number, platform, and C compiler */
#define PG_VERSION_STR "@PG_VERSION_STR@"

View File

@ -695,7 +695,7 @@
#define PG_VERSION "9.2.4"
/* openGauss version as a string */
#define OPENGAUSS_VERSION "3.1.0"
#define OPENGAUSS_VERSION "5.0.0"
/* Gaussdb version as a string*/
#define DEF_GS_VERSION "(GaussDB A 8.0.0 build 21f07aff) compiled at 2020-03-17 10:59:07 commit 7431 last mr 12039 debug"

View File

@ -121,6 +121,34 @@ fi])# PGAC_C_FUNCNAME_SUPPORT
# PGAC_CHECK_BUILTIN_FUNC
# -----------------------
# This is similar to AC_CHECK_FUNCS(), except that it will work for compiler
# builtin functions, as that usually fails to.
# The first argument is the function name, eg [__builtin_clzl], and the
# second is its argument list, eg [unsigned long x]. The current coding
# works only for a single argument named x; we might generalize that later.
# It's assumed that the function's result type is coercible to int.
# On success, we define "HAVEfuncname" (there's usually more than enough
# underscores already, so we don't add another one).
AC_DEFUN([PGAC_CHECK_BUILTIN_FUNC],
[AC_CACHE_CHECK(for $1, pgac_cv$1,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
int
call$1($2)
{
return $1(x);
}], [])],
[pgac_cv$1=yes],
[pgac_cv$1=no])])
if test x"${pgac_cv$1}" = xyes ; then
AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE$1]), 1,
[Define to 1 if your compiler understands $1.])
fi])# PGAC_CHECK_BUILTIN_FUNC
# PGAC_PROG_CC_CFLAGS_OPT
# -----------------------
# Given a string, check if the compiler supports the string as a

308
configure vendored
View File

@ -709,6 +709,7 @@ with_selinux
krb_srvtab
with_python
with_openeuler_os
with_openeuler_major
enable_thread_safety
INCLUDES
TAS
@ -828,6 +829,7 @@ enable_nls
with_pgport
with_gs_version
with_openeuler_os
with_openeuler_major
enable_shared
enable_rpath
enable_jemalloc
@ -2195,7 +2197,7 @@ PACKAGE_VERSION='9.2.4'
# Postgres-XC 1.1devel is based on PostgreSQL 9.2.4
PACKAGE_XC_VERSION='1.1'
# openGauss is based on PostgreSQL 9.2.4 and it will be the Kernel of GaussDB database
OPENGAUSS_VERSION='3.1.0'
OPENGAUSS_VERSION='5.0.0'
cat >>confdefs.h <<_ACEOF
#define PG_VERSION "$PACKAGE_VERSION"
@ -3272,6 +3274,9 @@ _ACEOF
fi
if [ "$(cat /etc/system-release)" == "openEuler release 22.03 LTS" ]; then
with_openeuler_major=yes
fi
#
# --enable-coverage enables generation of code coverage metrics with gcov
@ -3713,9 +3718,8 @@ case ${wal_segsize} in
128) ;;
256) ;;
512) ;;
1024) ;;
*) { { $as_echo "$as_me:$LINENO: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024." >&5
$as_echo "$as_me: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024." >&2;}
*) { { $as_echo "$as_me:$LINENO: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512." >&5
$as_echo "$as_me: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512." >&2;}
{ (exit 1); exit 1; }; }
esac
{ $as_echo "$as_me:$LINENO: result: ${wal_segsize}MB" >&5
@ -3727,9 +3731,9 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# Set number of MAX_ALLOC_SEGNUM in extreme_rto
if test "${wal_segsize}" -lt 512; then
if test "${wal_segsize}" -lt 256; then
MAX_ALLOC_SEGNUM=4
elif test "${wal_segsize}" -ge 512 -a "${wal_segsize}" -lt 1024; then
elif test "${wal_segsize}" -ge 256 -a "${wal_segsize}" -lt 512; then
MAX_ALLOC_SEGNUM=2
else
MAX_ALLOC_SEGNUM=1
@ -6477,7 +6481,11 @@ fi
# XML
#
if [[ "$enable_lite_mode" != yes ]]; then
with_libxml=yes
else
with_libxml=no
fi
# Check whether --with-libxml was given.
if test "${with_libxml+set}" = set; then
@ -6505,10 +6513,11 @@ else
fi
xml2_cflag=${with_3rdpartydir}/kernel/dependency/libxml2/comm/include/libxml2
xml2_lib=${with_3rdpartydir}/kernel/dependency/libxml2/comm/lib
xml2_config=${with_3rdpartydir}/kernel/dependency/libxml2/comm/bin/xml2-config
if test "$with_libxml" = yes ; then
for ac_prog in xml2-config
for ac_prog in ${xml2_config}
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@ -6537,7 +6546,7 @@ IFS=$as_save_IFS
fi
fi
XML2_CONFIG=$ac_cv_prog_XML2_CONFIG
XML2_CONFIG=$xml2_config
if test -n "$XML2_CONFIG"; then
{ $as_echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5
$as_echo "$XML2_CONFIG" >&6; }
@ -6553,12 +6562,12 @@ done
if test -n "$XML2_CONFIG"; then
for pgac_option in `$XML2_CONFIG --cflags`; do
case $pgac_option in
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option -I${xml2_cflag}";;
esac
done
for pgac_option in `$XML2_CONFIG --libs`; do
case $pgac_option in
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
-L*) LDFLAGS="$LDFLAGS $pgac_option -L${xml2_lib}";;
esac
done
fi
@ -9842,7 +9851,7 @@ if test "${ac_cv_lib_xml2_xmlSaveToBuffer+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lxml2 $LIBS"
LIBS="-L${xml2_lib} -lxml2 -lm -ldl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@ -13434,6 +13443,7 @@ done
fi
if test "$with_libxml" = yes ; then
CPPFLAGS="-I${xml2_cflag} $CPPFLAGS"
if test "${ac_cv_header_libxml_parser_h+set}" = set; then
{ $as_echo "$as_me:$LINENO: checking for libxml/parser.h" >&5
$as_echo_n "checking for libxml/parser.h... " >&6; }
@ -18216,9 +18226,47 @@ fi
# On PPC, check if assembler supports LWARX instruction's mutex hint bit
case $host_cpu in
x86_64)
# On x86_64, check if we can compile a popcntq instruction
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether assembler supports x86_64 popcntq" >&5
$as_echo_n "checking whether assembler supports x86_64 popcntq... " >&6; }
if ${pgac_cv_have_x86_64_popcntq+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
long long x = 1; long long r;
__asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
pgac_cv_have_x86_64_popcntq=yes
else
pgac_cv_have_x86_64_popcntq=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_have_x86_64_popcntq" >&5
$as_echo "$pgac_cv_have_x86_64_popcntq" >&6; }
if test x"$pgac_cv_have_x86_64_popcntq" = xyes ; then
$as_echo "#define HAVE_X86_64_POPCNTQ 1" >>confdefs.h
fi
;;
ppc*|powerpc*)
{ $as_echo "$as_me:$LINENO: checking whether assembler supports lwarx hint bit" >&5
$as_echo_n "checking whether assembler supports lwarx hint bit... " >&6; }
if ${pgac_cv_have_ppc_mutex_hint+:} false; then :
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@ -18262,6 +18310,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_have_ppc_mutex_hint" >&5
$as_echo "$pgac_cv_have_ppc_mutex_hint" >&6; }
if test x"$pgac_cv_have_ppc_mutex_hint" = xyes ; then
@ -24841,6 +24890,237 @@ cat >>confdefs.h <<_ACEOF
#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
_ACEOF
# These typically are compiler builtins, for which AC_CHECK_FUNCS fails.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap16" >&5
$as_echo_n "checking for __builtin_bswap16... " >&6; }
if ${pgac_cv__builtin_bswap16+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_bswap16(int x)
{
return __builtin_bswap16(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_bswap16=yes
else
pgac_cv__builtin_bswap16=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap16" >&5
$as_echo "$pgac_cv__builtin_bswap16" >&6; }
if test x"${pgac_cv__builtin_bswap16}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_BSWAP16 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap32" >&5
$as_echo_n "checking for __builtin_bswap32... " >&6; }
if ${pgac_cv__builtin_bswap32+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_bswap32(int x)
{
return __builtin_bswap32(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_bswap32=yes
else
pgac_cv__builtin_bswap32=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap32" >&5
$as_echo "$pgac_cv__builtin_bswap32" >&6; }
if test x"${pgac_cv__builtin_bswap32}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_BSWAP32 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_bswap64" >&5
$as_echo_n "checking for __builtin_bswap64... " >&6; }
if ${pgac_cv__builtin_bswap64+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_bswap64(long int x)
{
return __builtin_bswap64(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_bswap64=yes
else
pgac_cv__builtin_bswap64=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_bswap64" >&5
$as_echo "$pgac_cv__builtin_bswap64" >&6; }
if test x"${pgac_cv__builtin_bswap64}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_BSWAP64 1
_ACEOF
fi
# We assume that we needn't test all widths of these explicitly:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_clz" >&5
$as_echo_n "checking for __builtin_clz... " >&6; }
if ${pgac_cv__builtin_clz+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_clz(unsigned int x)
{
return __builtin_clz(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_clz=yes
else
pgac_cv__builtin_clz=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_clz" >&5
$as_echo "$pgac_cv__builtin_clz" >&6; }
if test x"${pgac_cv__builtin_clz}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_CLZ 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_ctz" >&5
$as_echo_n "checking for __builtin_ctz... " >&6; }
if ${pgac_cv__builtin_ctz+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_ctz(unsigned int x)
{
return __builtin_ctz(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_ctz=yes
else
pgac_cv__builtin_ctz=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_ctz" >&5
$as_echo "$pgac_cv__builtin_ctz" >&6; }
if test x"${pgac_cv__builtin_ctz}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_CTZ 1
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
$as_echo_n "checking for __builtin_popcount... " >&6; }
if ${pgac_cv__builtin_popcount+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
call__builtin_popcount(unsigned int x)
{
return __builtin_popcount(x);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv__builtin_popcount=yes
else
pgac_cv__builtin_popcount=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_popcount" >&5
$as_echo "$pgac_cv__builtin_popcount" >&6; }
if test x"${pgac_cv__builtin_popcount}" = xyes ; then
cat >>confdefs.h <<_ACEOF
#define HAVE__BUILTIN_POPCOUNT 1
_ACEOF
fi
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects

View File

@ -384,8 +384,7 @@ case ${wal_segsize} in
128) ;;
256) ;;
512) ;;
1024) ;;
*) AC_MSG_ERROR([Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024.])
*) AC_MSG_ERROR([Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512.])
esac
AC_MSG_RESULT([${wal_segsize}MB])
@ -398,9 +397,9 @@ AC_DEFINE_UNQUOTED([XLOG_SEG_SIZE], [(${wal_segsize} * 1024 * 1024)], [
])
# Set number of MAX_ALLOC_SEGNUM in extreme_rto
if test "${wal_segsize}" -lt 512; then
if test "${wal_segsize}" -lt 256; then
MAX_ALLOC_SEGNUM=4
elif test "${wal_segsize}" -ge 512 -a "${wal_segsize}" -lt 1024; then
elif test "${wal_segsize}" -ge 256 -a "${wal_segsize}" -lt 512; then
MAX_ALLOC_SEGNUM=2
else
MAX_ALLOC_SEGNUM=1
@ -1187,6 +1186,19 @@ fi
# On PPC, check if assembler supports LWARX instruction's mutex hint bit
case $host_cpu in
x86_64)
# On x86_64, check if we can compile a popcntq instruction
AC_CACHE_CHECK([whether assembler supports x86_64 popcntq],
[pgac_cv_have_x86_64_popcntq],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[long long x = 1; long long r;
__asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));])],
[pgac_cv_have_x86_64_popcntq=yes],
[pgac_cv_have_x86_64_popcntq=no])])
if test x"$pgac_cv_have_x86_64_popcntq" = xyes ; then
AC_DEFINE(HAVE_X86_64_POPCNTQ, 1, [Define to 1 if the assembler supports X86_64's POPCNTQ instruction.])
fi
;;
ppc*|powerpc*)
AC_MSG_CHECKING([whether assembler supports lwarx hint bit])
AC_TRY_COMPILE([],
@ -1235,6 +1247,9 @@ LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat readlink setproctitle setsid sigprocmask symlink sync_file_range towlower utime utimes waitpid wcstombs wcstombs_l])
# We assume that we needn't test all widths of these explicitly:
PGAC_CHECK_BUILTIN_FUNC([__builtin_clz], [unsigned int x])
AC_REPLACE_FUNCS(fseeko)
case $host_os in
# NetBSD uses a custom fseeko/ftello built on fsetpos/fgetpos

View File

@ -3,7 +3,7 @@
MODULE_big = dblink
OBJS = dblink.o
PG_CPPFLAGS = -I$(libpq_srcdir)
SHLIB_LINK = $(libpq)
SHLIB_LINK = $(libpq) -L$(LIBODBC_LIB_PATH) -lodbc
SHLIB_PREREQS = submake-libpq
EXTENSION = dblink

View File

@ -221,3 +221,8 @@ CREATE FUNCTION dblink_get_notify(
RETURNS setof record
AS 'MODULE_PATHNAME', 'dblink_get_notify'
LANGUAGE C STRICT;
CREATE FUNCTION dblink_get_drivername()
RETURNS text
AS 'MODULE_PATHNAME', 'dblink_get_drivername'
LANGUAGE C STRICT;

View File

@ -44,3 +44,4 @@ ALTER EXTENSION dblink ADD function dblink_cancel_query(text);
ALTER EXTENSION dblink ADD function dblink_error_message(text);
ALTER EXTENSION dblink ADD function dblink_get_notify();
ALTER EXTENSION dblink ADD function dblink_get_notify(text);
ALTER EXTENSION dblink ADD function dblink_get_drivername();

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,113 @@
#define DBLINK_H
#include "fmgr.h"
#include "sql.h"
#include "sqlext.h"
typedef struct ODBCconn {
SQLHENV envHandle; /* Handle ODBC environment */
SQLHDBC connHandle; /* Handle connection */
SQLHSTMT stmt; /* Handle sql */
} ODBCconn;
typedef struct storeInfo {
FunctionCallInfo fcinfo;
Tuplestorestate* tuplestore;
AttInMetadata* attinmeta;
MemoryContext tmpcontext;
char** cstrs;
/* temp storage for results to avoid leaks on exception */
PGresult* last_res;
PGresult* cur_res;
} storeInfo;
typedef struct LinkInfo {
SQLCHAR* username; /* odbc username */
SQLCHAR* password; /* odbc password */
SQLCHAR* drivername; /* odbc driver name */
} LinkInfo;
class Linker : public BaseObject {
public:
virtual void finish() = 0;
virtual text* exec(char* conname, const char* sql, bool fail) = 0;
virtual char* errorMsg() = 0;
virtual int isBusy() = 0;
virtual char* cancel(PGcancel* cancel) = 0;
virtual int sendQuery(char* sql) = 0;
virtual char* open(char* conname, char* sql, bool fail) = 0;
virtual char* close(char* conname, char* sql, bool fail) = 0;
virtual void getResult(char* conname, FunctionCallInfo fcinfo, char* sql, bool fail) = 0;
virtual void queryResult(ReturnSetInfo* rsinfo, const char* conname, storeInfo* sinfo, const char* sql, bool fail) = 0;
virtual void fetch(char* conname, FunctionCallInfo fcinfo, const char* sql, bool fail, char* curname) = 0;
virtual void getNotify(ReturnSetInfo* rsinfo) = 0;
};
typedef struct remoteConn {
Linker* linker;
} remoteConn;
typedef struct dblink_session_context {
remoteConn* pconn;
HTAB* remoteConnHash;
} dblink_session_context;
/*
* Following is list that holds multiple remote connections.
* Calling convention of each dblink function changes to accept
* connection name as the first parameter. The connection list is
* much like ecpg e.g. a mapping between a name and a PGconn object.
*/
typedef struct remoteConnHashEnt {
char name[NAMEDATALEN];
remoteConn* rconn;
} remoteConnHashEnt;
class PQLinker : public Linker {
public:
PGconn* conn;
PGresult* res;
int openCursorCount; /* The number of open cursors */
bool newXactForCursor; /* Opened a transaction for a cursor */
public:
PQLinker(char* connstr);
void finish();
text* exec(char* conname, const char* sql, bool fail);
char* errorMsg();
int isBusy();
char* cancel(PGcancel* cancel);
int sendQuery(char* sql);
char* open(char* conname, char* sql, bool fail);
char* close(char* conname, char* sql, bool fail);
void getResult(char* conname, FunctionCallInfo fcinfo, char* sql, bool fail);
void queryResult(ReturnSetInfo* rsinfo, const char* conname, storeInfo* sinfo, const char* sql, bool fail);
void fetch(char* conname, FunctionCallInfo fcinfo, const char* sql, bool fail, char* curname);
void getNotify(ReturnSetInfo* rsinfo);
};
class ODBCLinker : public Linker {
public:
SQLHENV envHandle; /* Handle ODBC environment */
SQLHDBC connHandle; /* Handle connection */
SQLHSTMT stmt; /* Handle sql */
public:
ODBCLinker(char* connstr_or_name);
void finish();
text* exec(char* conname, const char* sql, bool fail);
char* errorMsg();
int isBusy();
char* cancel(PGcancel* cancel);
int sendQuery(char* sql);
char* open(char* conname, char* sql, bool fail);
char* close(char* conname, char* sql, bool fail);
void getResult(char* conname, FunctionCallInfo fcinfo, char* sql, bool fail);
void queryResult(ReturnSetInfo* rsinfo, const char* conname, storeInfo* sinfo, const char* sql, bool fail);
void fetch(char* conname, FunctionCallInfo fcinfo, const char* sql, bool fail, char* curname);
void getNotify(ReturnSetInfo* rsinfo);
};
/*
* External declarations
@ -58,6 +165,7 @@ extern "C" Datum dblink_build_sql_delete(PG_FUNCTION_ARGS);
extern "C" Datum dblink_build_sql_update(PG_FUNCTION_ARGS);
extern "C" Datum dblink_current_query(PG_FUNCTION_ARGS);
extern "C" Datum dblink_get_notify(PG_FUNCTION_ARGS);
extern "C" Datum dblink_get_drivername(PG_FUNCTION_ARGS);
extern "C" void set_extension_index(uint32 index);
extern "C" void init_session_vars(void);

View File

@ -375,7 +375,7 @@ static List* get_file_fdw_attribute_options(Oid relid)
/* Retrieve FDW options for all user-defined attributes. */
for (attnum = 1; attnum <= natts; attnum++) {
Form_pg_attribute attr = tupleDesc->attrs[attnum - 1];
Form_pg_attribute attr = &tupleDesc->attrs[attnum - 1];
List* options = NIL;
ListCell* lc = NULL;
@ -712,7 +712,7 @@ static void estimate_size(PlannerInfo* root, RelOptInfo* baserel, FileFdwPlanSta
*/
int tuple_width;
tuple_width = MAXALIGN(baserel->width) + MAXALIGN(sizeof(HeapTupleHeaderData));
tuple_width = MAXALIGN(baserel->reltarget->width) + MAXALIGN(sizeof(HeapTupleHeaderData));
ntuples = clamp_row_est((double)stat_buf.st_size / (double)tuple_width);
baserel->tuples = ntuples;

View File

@ -745,7 +745,7 @@ List* build_tlist_to_deparse(RelOptInfo* foreignrel)
* We require columns specified in foreignrel->reltarget->exprs and those
* required for evaluating the local conditions.
*/
tlist = foreignrel->reltargetlist;
tlist = foreignrel->reltarget->exprs;
foreach (lc, fpinfo->local_conds) {
RestrictInfo* rinfo = lfirst_node(RestrictInfo, lc);
@ -929,7 +929,7 @@ static void gcdeparseTargetList(StringInfo buf, PlannerInfo* root, Index rtindex
have_wholerow = bms_is_member(0 - FirstLowInvalidHeapAttributeNumber, attrs_used);
for (i = 1; i <= tupdesc->natts; i++) {
Form_pg_attribute attr = tupdesc->attrs[i - 1];
Form_pg_attribute attr = &tupdesc->attrs[i - 1];
/* Ignore dropped attributes. */
if (attr->attisdropped)
@ -1122,7 +1122,7 @@ static void gcDeparseSubqueryTargetList(deparse_expr_cxt* context)
/* Should only be called in these cases. */
Assert(IS_SIMPLE_REL(foreignrel) || IS_JOIN_REL(foreignrel));
foreach (lc, foreignrel->reltargetlist) {
foreach (lc, foreignrel->reltarget->exprs) {
Node* node = (Node*)lfirst(lc);
if (!first)
@ -2213,7 +2213,7 @@ static void get_relation_column_alias_ids(Var* node, RelOptInfo* foreignrel, int
/* Get the column alias ID */
i = 1;
foreach (lc, foreignrel->reltargetlist) {
foreach (lc, foreignrel->reltarget->exprs) {
if (equal(lfirst(lc), (Node*)node)) {
*colno = i;
return;

View File

@ -348,7 +348,7 @@ static void gcGetForeignRelSize(PlannerInfo* root, RelOptInfo* baserel, Oid fore
* columns used in them. Doesn't seem worth detecting that case though.)
*/
fpinfo->attrs_used = NULL;
pull_varattnos((Node*)baserel->reltargetlist, baserel->relid, &fpinfo->attrs_used);
pull_varattnos((Node*)baserel->reltarget->exprs, baserel->relid, &fpinfo->attrs_used);
foreach (lc, fpinfo->local_conds) {
RestrictInfo* rinfo = lfirst_node(RestrictInfo, lc);
@ -390,7 +390,7 @@ static void gcGetForeignRelSize(PlannerInfo* root, RelOptInfo* baserel, Oid fore
baserel->pages = 10;
const int BLOCK_NUM = 10;
baserel->tuples =
(double)(BLOCK_NUM * BLCKSZ) / (baserel->width + MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)));
(double)(BLOCK_NUM * BLCKSZ) / (baserel->reltarget->width + MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)));
}
/* Estimate baserel size as best we can with local statistics. */
@ -702,7 +702,7 @@ static void gcBeginForeignScan(ForeignScanState* node, int eflags)
for (int i = 0; i < list_length(fsstate->retrieved_attrs); i++) {
int attidx = list_nth_int(fsstate->retrieved_attrs, i);
Form_pg_attribute attr = slot->tts_tupleDescriptor->attrs[attidx - 1];
Form_pg_attribute attr = &slot->tts_tupleDescriptor->attrs[attidx - 1];
const char* attname = (const char*)(attr->attname.data);
TupleDescInitEntry(scan_desc, i + 1, attname, attr->atttypid, attr->atttypmod, 0);
}
@ -747,8 +747,8 @@ static void gcBeginForeignScan(ForeignScanState* node, int eflags)
fsstate->resultSlot->tts_isnull[i] = true;
}
fsstate->resultSlot->tts_isempty = false;
fsstate->scanSlot->tts_isempty = false;
fsstate->resultSlot->tts_flags &= ~TTS_FLAG_EMPTY;
fsstate->scanSlot->tts_flags &= ~TTS_FLAG_EMPTY;
fsstate->attinmeta = TupleDescGetAttInMetadata(fsstate->tupdesc);
@ -864,7 +864,7 @@ static void postgresConstructResultSlotWithArray(ForeignScanState* node)
for (scanAttr = 0, resultAttr = 0; resultAttr < resultDesc->natts; resultAttr++, scanAttr += map) {
Assert(list_length(colmap) == resultDesc->natts);
Oid typoid = resultDesc->attrs[resultAttr]->atttypid;
Oid typoid = resultDesc->attrs[resultAttr].atttypid;
Value* val = (Value*)list_nth(colmap, resultAttr);
map = val->val.ival;
@ -919,7 +919,7 @@ static void postgresConstructResultSlotWithArray(ForeignScanState* node)
}
resultSlot->tts_nvalid = resultDesc->natts;
resultSlot->tts_isempty = false;
resultSlot->tts_flags &= ~TTS_FLAG_EMPTY;
}
static void postgresMapResultFromScanSlot(ForeignScanState* node)
@ -958,7 +958,7 @@ static TupleTableSlot* gcIterateNormalForeignScan(ForeignScanState* node)
/* reset tupleslot on the begin */
(void)ExecClearTuple(fsstate->resultSlot);
fsstate->resultSlot->tts_isempty = false;
fsstate->resultSlot->tts_flags &= ~TTS_FLAG_EMPTY;
TupleTableSlot* slot = node->ss.ss_ScanTupleSlot;
@ -1469,7 +1469,7 @@ static void gc_estimate_path_cost_size(PlannerInfo* root, RelOptInfo* foreignrel
* between foreign relations.
*/
rows = foreignrel->rows;
width = foreignrel->width;
width = foreignrel->reltarget->width;
/* Back into an estimate of the number of retrieved rows. */
retrieved_rows = clamp_row_est(rows / fpinfo->local_conds_sel);
@ -1813,17 +1813,17 @@ static void gcfdw_fetch_remote_table_info(
pq_sendint(&retbuf, tupdesc->natts, 4);
for (int i = 0; i < tupdesc->natts; i++) {
att_name_len = strlen(tupdesc->attrs[i]->attname.data);
att_name_len = strlen(tupdesc->attrs[i].attname.data);
pq_sendint(&retbuf, att_name_len, 4);
pq_sendbytes(&retbuf, tupdesc->attrs[i]->attname.data, att_name_len);
pq_sendbytes(&retbuf, tupdesc->attrs[i].attname.data, att_name_len);
Assert(InvalidOid != tupdesc->attrs[i]->atttypid);
Assert(InvalidOid != tupdesc->attrs[i].atttypid);
type_name = get_typename(tupdesc->attrs[i]->atttypid);
type_name = get_typename(tupdesc->attrs[i].atttypid);
type_name_len = strlen(type_name);
pq_sendint(&retbuf, type_name_len, 4);
pq_sendbytes(&retbuf, type_name, type_name_len);
pq_sendint(&retbuf, tupdesc->attrs[i]->atttypmod, 4);
pq_sendint(&retbuf, tupdesc->attrs[i].atttypmod, 4);
pfree(type_name);
}
@ -2368,7 +2368,7 @@ static void conversion_error_callback(void *arg)
TupleDesc tupdesc = RelationGetDescr(errpos->rel);
if (errpos->cur_attno > 0 && errpos->cur_attno <= tupdesc->natts) {
attname = NameStr(tupdesc->attrs[errpos->cur_attno - 1]->attname);
attname = NameStr(tupdesc->attrs[errpos->cur_attno - 1].attname);
} else if (errpos->cur_attno == SelfItemPointerAttributeNumber) {
attname = "ctid";
} else if (errpos->cur_attno == ObjectIdAttributeNumber) {
@ -2588,7 +2588,7 @@ static void GcFdwCopyRemoteInfo(PgFdwRemoteInfo* new_remote_info, PgFdwRemoteInf
bool hasSpecialArrayType(TupleDesc desc)
{
for (int i = 0; i < desc->natts; i++) {
Oid typoid = desc->attrs[i]->atttypid;
Oid typoid = desc->attrs[i].atttypid;
if (INT8ARRAYOID == typoid || FLOAT8ARRAYOID == typoid || FLOAT4ARRAYOID == typoid || NUMERICARRAY == typoid) {
return true;

View File

@ -702,15 +702,15 @@ Datum hstore_from_record(PG_FUNCTION_ARGS)
for (i = 0, j = 0; i < ncolumns; ++i) {
ColumnIOData* column_info = &my_extra->columns[i];
Oid column_type = tupdesc->attrs[i]->atttypid;
Oid column_type = tupdesc->attrs[i].atttypid;
char* value = NULL;
/* Ignore dropped columns in datatype */
if (tupdesc->attrs[i]->attisdropped)
if (tupdesc->attrs[i].attisdropped)
continue;
pairs[j].key = NameStr(tupdesc->attrs[i]->attname);
pairs[j].keylen = hstoreCheckKeyLen(strlen(NameStr(tupdesc->attrs[i]->attname)));
pairs[j].key = NameStr(tupdesc->attrs[i].attname);
pairs[j].keylen = hstoreCheckKeyLen(strlen(NameStr(tupdesc->attrs[i].attname)));
if (nulls == NULL || nulls[i]) {
pairs[j].val = NULL;
@ -864,18 +864,18 @@ Datum hstore_populate_record(PG_FUNCTION_ARGS)
for (i = 0; i < ncolumns; ++i) {
ColumnIOData* column_info = &my_extra->columns[i];
Oid column_type = tupdesc->attrs[i]->atttypid;
Oid column_type = tupdesc->attrs[i].atttypid;
char* value = NULL;
int idx;
int vallen;
/* Ignore dropped columns in datatype */
if (tupdesc->attrs[i]->attisdropped) {
if (tupdesc->attrs[i].attisdropped) {
nulls[i] = true;
continue;
}
idx = hstoreFindKey(hs, 0, NameStr(tupdesc->attrs[i]->attname), strlen(NameStr(tupdesc->attrs[i]->attname)));
idx = hstoreFindKey(hs, 0, NameStr(tupdesc->attrs[i].attname), strlen(NameStr(tupdesc->attrs[i].attname)));
/*
* we can't just skip here if the key wasn't found since we might have
@ -903,7 +903,7 @@ Datum hstore_populate_record(PG_FUNCTION_ARGS)
* checks are done
*/
values[i] =
InputFunctionCall(&column_info->proc, NULL, column_info->typioparam, tupdesc->attrs[i]->atttypmod);
InputFunctionCall(&column_info->proc, NULL, column_info->typioparam, tupdesc->attrs[i].atttypmod);
nulls[i] = true;
} else {
vallen = HS_VALLEN(entries, idx);
@ -913,7 +913,7 @@ Datum hstore_populate_record(PG_FUNCTION_ARGS)
value[vallen] = 0;
values[i] =
InputFunctionCall(&column_info->proc, value, column_info->typioparam, tupdesc->attrs[i]->atttypmod);
InputFunctionCall(&column_info->proc, value, column_info->typioparam, tupdesc->attrs[i].atttypmod);
nulls[i] = false;
}
}

View File

@ -6,6 +6,7 @@
#include "access/gist.h"
#include "access/skey.h"
#include "port/pg_bitutils.h"
#include "_int.h"
@ -29,264 +30,6 @@ extern "C" Datum g_intbig_picksplit(PG_FUNCTION_ARGS);
extern "C" Datum g_intbig_union(PG_FUNCTION_ARGS);
extern "C" Datum g_intbig_same(PG_FUNCTION_ARGS);
/* Number of one-bits in an unsigned byte */
static const uint8 number_of_ones[256] = {0,
1,
1,
2,
1,
2,
2,
3,
1,
2,
2,
3,
2,
3,
3,
4,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
4,
5,
5,
6,
5,
6,
6,
7,
5,
6,
6,
7,
6,
7,
7,
8};
PG_FUNCTION_INFO_V1(_intbig_in);
extern "C" Datum _intbig_in(PG_FUNCTION_ARGS);
@ -428,11 +171,7 @@ Datum g_intbig_compress(PG_FUNCTION_ARGS)
static int4 sizebitvec(BITVECP sign)
{
int4 size = 0, i;
LOOPBYTE
size += number_of_ones[(unsigned char)sign[i]];
return size;
return pg_popcount(sign, SIGLEN);
}
static int hemdistsign(BITVECP a, BITVECP b)
@ -442,7 +181,8 @@ static int hemdistsign(BITVECP a, BITVECP b)
LOOPBYTE
{
diff = (unsigned char)(a[i] ^ b[i]);
dist += number_of_ones[diff];
/* Using the popcount functions here isn't likely to win */
dist += pg_number_of_ones[diff];
}
return dist;
}

View File

@ -1530,7 +1530,7 @@ static void fill_pglog_planstate_from_logft_rel(pglogPlanState* pg_log, Relation
Assert(PGLOG_ATTR_MAX == tupdesc->natts);
for (int i = 0; i < PGLOG_ATTR_MAX; ++i) {
Form_pg_attribute att = tupdesc->attrs[i];
Form_pg_attribute att = &tupdesc->attrs[i];
pg_log->allattr_typmod[i] = att->atttypmod;
getTypeInputInfo(att->atttypid, &in_func_oid, &pg_log->allattr_typioparam[i]);
fmgr_info(in_func_oid, &pg_log->allattr_fmgrinfo[i]);

View File

@ -10,6 +10,7 @@
#include "access/gist.h"
#include "access/skey.h"
#include "port/pg_bitutils.h"
#include "crc32.h"
#include "ltree.h"
@ -34,264 +35,6 @@ extern "C" Datum _ltree_consistent(PG_FUNCTION_ARGS);
#define GETENTRY(vec, pos) ((ltree_gist*)DatumGetPointer((vec)->vector[(pos)].key))
#define NEXTVAL(x) ((ltree*)((char*)(x) + INTALIGN(VARSIZE(x))))
/* Number of one-bits in an unsigned byte */
static const uint8 number_of_ones[256] = {0,
1,
1,
2,
1,
2,
2,
3,
1,
2,
2,
3,
2,
3,
3,
4,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
4,
5,
5,
6,
5,
6,
6,
7,
5,
6,
6,
7,
6,
7,
7,
8};
#define WISH_F(a, b, c) (double)(-(double)(((a) - (b)) * ((a) - (b)) * ((a) - (b))) * (c))
static void hashing(BITVECP sign, ltree* t)
@ -431,11 +174,7 @@ Datum _ltree_union(PG_FUNCTION_ARGS)
static int4 sizebitvec(BITVECP sign)
{
int4 size = 0, i;
ALOOPBYTE
size += number_of_ones[(unsigned char)sign[i]];
return size;
return pg_popcount((const char *) sign, ASIGLEN);
}
static int hemdistsign(BITVECP a, BITVECP b)
@ -445,7 +184,8 @@ static int hemdistsign(BITVECP a, BITVECP b)
ALOOPBYTE
{
diff = (unsigned char)(a[i] ^ b[i]);
dist += number_of_ones[diff];
/* Using the popcount functions here isn't likely to win */
dist += pg_number_of_ones[diff];
}
return dist;
}

View File

@ -226,8 +226,8 @@ static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id)
}
/* print the tuple 'tuple' into the StringInfo s */
static void TupleToJsoninfo(
cJSON* cols_name, cJSON* cols_type, cJSON* cols_val, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
static void TupleToJsoninfo(Relation relation, cJSON* cols_name, cJSON* cols_type, cJSON* cols_val, TupleDesc tupdesc,
HeapTuple tuple, bool isOld)
{
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
@ -241,7 +241,7 @@ static void TupleToJsoninfo(
Datum origval = 0; /* possibly toasted Datum */
bool isnull = false; /* column is null? */
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
Form_pg_attribute attr = &tupdesc->attrs[natt]; /* the attribute itself */
/*
* don't print dropped columns, we can't be sure everything is
@ -254,7 +254,7 @@ static void TupleToJsoninfo(
* Don't print system columns, oid will already have been printed if
* present.
*/
if (attr->attnum < 0)
if (attr->attnum < 0 || (isOld && !IsRelationReplidentKey(relation, attr->attnum)))
continue;
Oid typid = attr->atttypid; /* type of current attribute */
@ -265,8 +265,6 @@ static void TupleToJsoninfo(
} else {
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
}
if (isnull && skip_nulls)
continue;
/* print attribute name */
@ -355,53 +353,53 @@ static void pg_decode_change(
case REORDER_BUFFER_CHANGE_INSERT:
op_type = cJSON_CreateString("INSERT");
if (change->data.tp.newtuple != NULL) {
TupleToJsoninfo(
columns_name, columns_type, columns_val, tupdesc, &change->data.tp.newtuple->tuple, false);
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
&change->data.tp.newtuple->tuple, false);
}
break;
case REORDER_BUFFER_CHANGE_UPDATE:
op_type = cJSON_CreateString("UPDATE");
if (change->data.tp.oldtuple != NULL) {
TupleToJsoninfo(
old_keys_name, old_keys_type, old_keys_val, tupdesc, &change->data.tp.oldtuple->tuple, true);
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
&change->data.tp.oldtuple->tuple, true);
}
if (change->data.tp.newtuple != NULL) {
TupleToJsoninfo(
columns_name, columns_type, columns_val, tupdesc, &change->data.tp.newtuple->tuple, false);
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
&change->data.tp.newtuple->tuple, false);
}
break;
case REORDER_BUFFER_CHANGE_DELETE:
op_type = cJSON_CreateString("DELETE");
if (change->data.tp.oldtuple != NULL) {
TupleToJsoninfo(
old_keys_name, old_keys_type, old_keys_val, tupdesc, &change->data.tp.oldtuple->tuple, true);
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
&change->data.tp.oldtuple->tuple, true);
}
/* if there was no PK, we only know that a delete happened */
break;
case REORDER_BUFFER_CHANGE_UINSERT:
op_type = cJSON_CreateString("INSERT");
if (change->data.utp.newtuple != NULL) {
TupleToJsoninfo(columns_name, columns_type, columns_val, tupdesc,
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
(HeapTuple)(&change->data.utp.newtuple->tuple), false);
}
break;
case REORDER_BUFFER_CHANGE_UDELETE:
op_type = cJSON_CreateString("DELETE");
if (change->data.utp.oldtuple != NULL) {
TupleToJsoninfo(old_keys_name, old_keys_type, old_keys_val, tupdesc,
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
(HeapTuple)(&change->data.utp.oldtuple->tuple), true);
}
break;
case REORDER_BUFFER_CHANGE_UUPDATE:
op_type = cJSON_CreateString("UPDATE");
if (change->data.utp.oldtuple != NULL) {
TupleToJsoninfo(old_keys_name, old_keys_type, old_keys_val, tupdesc,
TupleToJsoninfo(relation, old_keys_name, old_keys_type, old_keys_val, tupdesc,
(HeapTuple)(&change->data.utp.oldtuple->tuple), true);
}
if (change->data.utp.newtuple != NULL) {
TupleToJsoninfo(columns_name, columns_type, columns_val, tupdesc,
TupleToJsoninfo(relation, columns_name, columns_type, columns_val, tupdesc,
(HeapTuple)&change->data.utp.newtuple->tuple, false);
}
break;

View File

@ -3160,8 +3160,9 @@ static int parse_page_file(const char *filename, SegmentType type, const uint32
char decompressed[BLCKSZ];
while (start < number) {
size_t compressedSize = pageCompression->ReadCompressedBuffer(start, compressed, BLCKSZ);
if (compressedSize == 0) {
fprintf(stderr, "read block %u failed, filename: %s: %s\n", start, filename, strerror(errno));
if (compressedSize > MIN_COMPRESS_ERROR_RT) {
fprintf(stderr, "read block %u failed, filename: %s: code: %lu %s\n",
start, filename, compressedSize, strerror(errno));
delete pageCompression;
return false;
}
@ -5435,6 +5436,7 @@ static void fill_filenode_map(char** class_map)
{"pg_cast_source_target_index", 2661},
{"pg_class_oid_index", 2662},
{"pg_class_relname_nsp_index", 2663},
{"pg_collation_enc_def_index", 3147},
{"pg_collation_name_enc_nsp_index", 3164},
{"pg_collation_oid_index", 3085},
{"pg_constraint_conname_nsp_index", 2664},

View File

@ -435,7 +435,7 @@ static void parse_compress_meta(StringInfo outputBuf, char* page_content, Relati
int size = PageGetSpecialSize(page_header);
TupleDesc desc = RelationGetDescr(rel);
Form_pg_attribute* att = desc->attrs;
FormData_pg_attribute* att = desc->attrs;
int attrno;
int attrnum = desc->natts;
@ -444,7 +444,7 @@ static void parse_compress_meta(StringInfo outputBuf, char* page_content, Relati
char mode = 0;
for (attrno = 0; attrno < attrnum && cmprsOff < size; ++attrno) {
Form_pg_attribute thisatt = att[attrno];
Form_pg_attribute thisatt = &att[attrno];
int metaSize = 0;
metaInfo = PageCompress::FetchAttrCmprMeta(start + cmprsOff, thisatt->attlen, &metaSize, &mode);

View File

@ -223,12 +223,14 @@ static void pgss_ExecutorStart(QueryDesc* queryDesc, int eflags);
static void pgss_ExecutorRun(QueryDesc* queryDesc, ScanDirection direction, long count);
static void pgss_ExecutorFinish(QueryDesc* queryDesc);
static void pgss_ExecutorEnd(QueryDesc* queryDesc);
static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamListInfo params, bool isTopLevel,
static void pgss_ProcessUtility(processutility_context* processutility_cxt,
DestReceiver* dest,
#ifdef PGXC
bool sentToRemote,
#endif /* PGXC */
char* completionTag);
char* completionTag,
ProcessUtilityContext context,
bool isCTAS);
static uint32 pgss_hash_fn(const void* key, Size keysize);
static int pgss_match_fn(const void* key1, const void* key2, Size keysize);
static uint32 pgss_hash_string(const char* str);
@ -722,13 +724,17 @@ static void pgss_ExecutorEnd(QueryDesc* queryDesc)
/*
* ProcessUtility hook
*/
static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamListInfo params, bool isTopLevel,
static void pgss_ProcessUtility(processutility_context* processutility_cxt,
DestReceiver* dest,
#ifdef PGXC
bool sentToRemote,
#endif /* PGXC */
char* completionTag)
char* completionTag,
ProcessUtilityContext context,
bool isCTAS)
{
Node* parsetree = processutility_cxt->parse_tree;
const char* queryString = processutility_cxt->query_string;
/*
* If it's an EXECUTE statement, we don't track it and don't increment the
* nesting level. This allows the cycles to be charged to the underlying
@ -754,25 +760,23 @@ static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamL
PG_TRY();
{
if (prev_ProcessUtility)
prev_ProcessUtility(parsetree,
queryString,
params,
isTopLevel,
prev_ProcessUtility(processutility_cxt,
dest,
#ifdef PGXC
sentToRemote,
#endif /* PGXC */
completionTag);
completionTag,
context,
isCTAS);
else
standard_ProcessUtility(parsetree,
queryString,
params,
isTopLevel,
standard_ProcessUtility(processutility_cxt,
dest,
#ifdef PGXC
sentToRemote,
#endif /* PGXC */
completionTag);
completionTag,
context,
isCTAS);
nested_level--;
}
PG_CATCH();
@ -817,25 +821,23 @@ static void pgss_ProcessUtility(Node* parsetree, const char* queryString, ParamL
pgss_store(queryString, queryId, INSTR_TIME_GET_MILLISEC(duration), rows, &bufusage, NULL);
} else {
if (prev_ProcessUtility)
prev_ProcessUtility(parsetree,
queryString,
params,
isTopLevel,
prev_ProcessUtility(processutility_cxt,
dest,
#ifdef PGXC
sentToRemote,
#endif /* PGXC */
completionTag);
completionTag,
context,
isCTAS);
else
standard_ProcessUtility(parsetree,
queryString,
params,
isTopLevel,
standard_ProcessUtility(processutility_cxt,
dest,
#ifdef PGXC
sentToRemote,
#endif /* PGXC */
completionTag);
completionTag,
context,
isCTAS);
}
}
@ -1858,7 +1860,7 @@ static void fill_in_constant_lengths(pgssJumbleState* jstate, const char* query)
locs = jstate->clocations;
/* initialize the flex scanner --- should match raw_parser() */
yyscanner = scanner_init(query, &yyextra, ScanKeywords, NumScanKeywords);
yyscanner = scanner_init(query, &yyextra, &ScanKeywords, ScanKeywordTokens);
/* Search for each constant, in sequence */
for (i = 0; i < jstate->clocations_count; i++) {

View File

@ -3,6 +3,7 @@
*/
#include "postgres.h"
#include "knl/knl_variable.h"
#include "port/pg_bitutils.h"
#include "trgm.h"
@ -40,264 +41,6 @@ extern "C" Datum gtrgm_picksplit(PG_FUNCTION_ARGS);
#define GETENTRY(vec, pos) ((TRGM*)DatumGetPointer((vec)->vector[(pos)].key))
/* Number of one-bits in an unsigned byte */
static const uint8 number_of_ones[256] = {0,
1,
1,
2,
1,
2,
2,
3,
1,
2,
2,
3,
2,
3,
3,
4,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
4,
5,
5,
6,
5,
6,
6,
7,
5,
6,
6,
7,
6,
7,
7,
8};
Datum gtrgm_in(PG_FUNCTION_ARGS)
{
elog(ERROR, "not implemented");
@ -677,11 +420,7 @@ Datum gtrgm_same(PG_FUNCTION_ARGS)
static int4 sizebitvec(BITVECP sign)
{
int4 size = 0, i;
LOOPBYTE
size += number_of_ones[(unsigned char)sign[i]];
return size;
return pg_popcount(sign, SIGLEN);
}
static int hemdistsign(BITVECP a, BITVECP b)
@ -691,7 +430,8 @@ static int hemdistsign(BITVECP a, BITVECP b)
LOOPBYTE
{
diff = (unsigned char)(a[i] ^ b[i]);
dist += number_of_ones[diff];
/* Using the popcount functions here isn't likely to win */
dist += pg_number_of_ones[diff];
}
return dist;
}

View File

@ -1038,6 +1038,9 @@ int main(int argc, char** argv)
}
}
if (dumpprivate.enable_dss)
XLogSegmentSize = DSS_XLOG_SEG_SIZE;
/* parse files as start/end boundaries, extract path if not specified */
if (optind < argc) {
char* directory = NULL;

View File

@ -121,7 +121,7 @@ static bool foreign_expr_walker(Node *node, foreign_glob_cxt *glob_cxt, foreign_
static void deparseTargetList(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, bool is_returning,
Bitmapset *attrs_used, bool qualify_col, List **retrieved_attrs);
static void deparseReturningList(StringInfo buf, RangeTblEntry *root, Index rtindex, Relation rel, bool trig_after_row,
List *returningList, List **retrieved_attrs);
List *withCheckOptionList, List *returningList, List **retrieved_attrs);
static void deparseColumnRef(StringInfo buf, int varno, int varattno, RangeTblEntry *rte, bool qualify_col);
static void deparseRelation(StringInfo buf, Relation rel);
static void deparseStringLiteral(StringInfo buf, const char *val);
@ -1158,7 +1158,7 @@ List *build_tlist_to_deparse(RelOptInfo *foreignrel)
* We require columns specified in foreignrel->reltarget->exprs and those
* required for evaluating the local conditions.
*/
tlist = add_to_flat_tlist(tlist, pull_var_clause((Node *)foreignrel->reltargetlist, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS));
tlist = add_to_flat_tlist(tlist, pull_var_clause((Node *)foreignrel->reltarget->exprs, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS));
foreach (lc, fpinfo->local_conds) {
RestrictInfo *rinfo = (RestrictInfo *)lfirst_node(RestrictInfo, lc);
@ -1548,7 +1548,7 @@ static void deparseSubqueryTargetList(deparse_expr_cxt *context)
Assert(IS_SIMPLE_REL(foreignrel) || IS_JOIN_REL(foreignrel));
first = true;
foreach (lc, foreignrel->reltargetlist) {
foreach (lc, foreignrel->reltarget->exprs) {
Node *node = (Node *)lfirst(lc);
if (!first) {
@ -1821,7 +1821,7 @@ static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root, RelOptInfo *fo
* expressions specified in the relation's reltarget (see
* deparseSubqueryTargetList).
*/
ncols = list_length(foreignrel->reltargetlist);
ncols = list_length(foreignrel->reltarget->exprs);
if (ncols > 0) {
int i;
@ -1844,11 +1844,11 @@ static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root, RelOptInfo *fo
* deparse remote INSERT statement
*
* The statement text is appended to buf, and we also create an integer List
* of the columns being retrieved by RETURNING (if any), which is returned
* to *retrieved_attrs.
* of the columns being retrieved by WITH CHECK OPTION or RETURNING (if any),
* which is returned to *retrieved_attrs.
*/
void deparseInsertSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
List *returningList, List **retrieved_attrs)
List *withCheckOptionList, List *returningList, List **retrieved_attrs)
{
AttrNumber pindex;
ListCell *lc = NULL;
@ -1890,19 +1890,19 @@ void deparseInsertSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relatio
appendStringInfoString(buf, " DEFAULT VALUES");
}
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_insert_after_row, returningList,
retrieved_attrs);
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_insert_after_row,
withCheckOptionList, returningList, retrieved_attrs);
}
/*
* deparse remote UPDATE statement
*
* The statement text is appended to buf, and we also create an integer List
* of the columns being retrieved by RETURNING (if any), which is returned
* to *retrieved_attrs.
* of the columns being retrieved by WITH CHECK OPTION or RETURNING (if any),
* which is returned to *retrieved_attrs.
*/
void deparseUpdateSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
List *returningList, List **retrieved_attrs)
List *withCheckOptionList, List *returningList, List **retrieved_attrs)
{
AttrNumber pindex;
ListCell *lc = NULL;
@ -1927,8 +1927,8 @@ void deparseUpdateSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relatio
}
appendStringInfoString(buf, " WHERE ctid = $1 and tableoid = $2");
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_update_after_row, returningList,
retrieved_attrs);
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_update_after_row,
withCheckOptionList, returningList, retrieved_attrs);
}
/*
@ -1945,15 +1945,15 @@ void deparseDeleteSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relatio
deparseRelation(buf, rel);
appendStringInfoString(buf, " WHERE ctid = $1 and tableoid = $2");
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_delete_after_row, returningList,
retrieved_attrs);
deparseReturningList(buf, rte, rtindex, rel, rel->trigdesc && rel->trigdesc->trig_delete_after_row, NIL,
returningList, retrieved_attrs);
}
/*
* Add a RETURNING clause, if needed, to an INSERT/UPDATE/DELETE.
*/
static void deparseReturningList(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, bool trig_after_row,
List *returningList, List **retrieved_attrs)
List *withCheckOptionList, List *returningList, List **retrieved_attrs)
{
Bitmapset *attrs_used = NULL;
@ -1962,6 +1962,19 @@ static void deparseReturningList(StringInfo buf, RangeTblEntry *rte, Index rtind
attrs_used = bms_make_singleton(0 - FirstLowInvalidHeapAttributeNumber);
}
if (withCheckOptionList != NIL) {
/*
* We need the attrs, non-system and system, mentioned in the local
* query's WITH CHECK OPTION list.
*
* Note: we do this to ensure that WCO constraints will be evaluated
* on the data actually inserted/updated on the remote side, which
* might differ from the data supplied by the core code, for example
* as a result of remote triggers.
*/
pull_varattnos((Node*)withCheckOptionList, rtindex, &attrs_used);
}
if (returningList != NIL) {
/*
* We need the attrs, non-system and system, mentioned in the local
@ -2017,7 +2030,7 @@ void deparseAnalyzeSql(StringInfo buf, Relation rel, List **retrieved_attrs)
appendStringInfoString(buf, "SELECT ");
for (i = 0; i < tupdesc->natts; i++) {
/* Ignore dropped columns. */
if (tupdesc->attrs[i]->attisdropped) {
if (tupdesc->attrs[i].attisdropped) {
continue;
}
@ -2027,7 +2040,7 @@ void deparseAnalyzeSql(StringInfo buf, Relation rel, List **retrieved_attrs)
first = false;
/* Use attribute name or column_name option. */
char *colname = NameStr(tupdesc->attrs[i]->attname);
char *colname = NameStr(tupdesc->attrs[i].attname);
List *options = GetForeignColumnOptions(relid, i + 1);
foreach (lc, options) {
@ -3385,7 +3398,7 @@ static void get_relation_column_alias_ids(Var *node, RelOptInfo *foreignrel, int
/* Get the column alias ID */
i = 1;
foreach (lc, foreignrel->reltargetlist) {
foreach (lc, foreignrel->reltarget->exprs) {
if (equal(lfirst(lc), (Node *)node)) {
*colno = i;
return;

View File

@ -1394,18 +1394,18 @@ SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
-- case when expr
explain (verbose, costs off) select * from ft1 where case c1 when 1 then 0 end = 0;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Foreign Scan on public.ft1
Output: c1, c2, c3, c4, c5, c6, c7, c8
Node ID: 1
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
Seq Scan on "S 1"."T 1"
Output: "C 1", c2, c3, c4, c5, c6, c7, c8
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END = 0::numeric)
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0 ELSE NULL::integer END = 0)
(11 rows)
@ -4698,7 +4698,6 @@ create operator public.>^ (
procedure = int4gt
);
create operator family my_op_family using btree;
ERROR: user defined operator is not yet supported.
create function my_op_cmp(a int, b int) returns int as
$$begin return btint4cmp(a, b); end $$ language plpgsql;
create operator class my_op_class for type int using btree family my_op_family as
@ -4706,23 +4705,34 @@ create operator class my_op_class for type int using btree family my_op_family a
operator 3 public.=^,
operator 5 public.>^,
function 1 my_op_cmp(int, int);
ERROR: operator family "my_op_family" does not exist for access method "btree"
-- NOTICES:
-- openGauss not support create operator class. remove the case. If you want to restore the test case later, refer to README in the file header.
-- This will not be pushed as sort operator is now removed from the extension.
explain (verbose, costs off)
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
ERROR: operator <^ is not a valid ordering operator
LINE 2: select array_agg(c1 order by c1 using operator(public.<^)) f...
^
HINT: Ordering operators must be "<" or ">" members of btree operator families.
CONTEXT: referenced column: array_agg
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
GroupAggregate
Output: array_agg(c1 ORDER BY c1 USING <^ NULLS LAST), c2
Group By Key: ft2.c2
-> Foreign Scan on public.ft2
Output: c2, c1
Node ID: 1
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
Index Scan using t1_pkey on "S 1"."T 1"
Output: "C 1", c2
Index Cond: ("T 1"."C 1" < 100)
Filter: ("T 1".c2 = 6)
(15 rows)
-- Cleanup
drop operator class my_op_class using btree;
ERROR: operator class "my_op_class" does not exist for access method "btree"
drop function my_op_cmp(a int, b int);
drop operator family my_op_family using btree;
ERROR: operator family "my_op_family" does not exist for access method "btree"
drop operator public.>^(int, int);
drop operator public.=^(int, int);
drop operator public.<^(int, int);
@ -8381,22 +8391,348 @@ UPDATE ft1 SET c2 = c2 + 1 WHERE c1 = 1;
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
ERROR: constraint "ft1_c2negative" of relation "ft1" does not exist
-- ======================================================================================================================================
-- TEST-MODULE: WITH CHECK OPTION constraints
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
-- --------------------------------------
-- openGauss not support WITH CHECK OPTION, so this test module is unuseful and cannot be fixed, remove it.
-- ======================================================================================================================================
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TABLE base_tbl (a int, b int);
CREATE TABLE base_tbl (id int, a int, b int);
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
\d+ rw_view1
View "public.rw_view1"
Column | Type | Modifiers | Storage | Description
--------+---------+-----------+---------+-------------
id | integer | | plain |
a | integer | | plain |
b | integer | | plain |
View definition:
SELECT *
FROM foreign_tbl
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 1;
\d+ rw_view2
View "public.rw_view2"
Column | Type | Modifiers | Storage | Description
--------+---------+-----------+---------+-------------
id | integer | | plain |
a | integer | | plain |
b | integer | | plain |
View definition:
SELECT *
FROM foreign_tbl
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 2;
Options: check_option=cascaded
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
select * from (
(select 'rw_view1', * from rw_view1 where id = 1) union all
(select 'rw_view2', * from rw_view2 where id = 2) union all
(select 'base_tbl', * from base_tbl) union all
(select 'foreign_tbl', * from foreign_tbl)
) data(tbname, id, a, b)
order by 1,2,3,4;
$$ language sql;
-- simple case
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 0, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 10, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 10, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 0, 5
(3 rows)
INSERT INTO rw_view2 VALUES (2, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 10, 5); -- should failed
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 10, 5
(3 rows)
INSERT INTO rw_view2 VALUES (2, 10, 5);
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 10, 5).
select * from checkdata();
tbname | id | a | b
-------------+----+----+---
base_tbl | 1 | 0 | 5
base_tbl | 1 | 10 | 5
base_tbl | 2 | 0 | 5
foreign_tbl | 1 | 0 | 5
foreign_tbl | 1 | 10 | 5
foreign_tbl | 2 | 0 | 5
rw_view1 | 1 | 0 | 5
rw_view2 | 2 | 0 | 5
(8 rows)
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
(12 rows)
UPDATE rw_view1 SET a = a + 20 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
(12 rows)
UPDATE rw_view2 SET a = a + 20 where id = 2;
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 20, 5).
select * from checkdata();
tbname | id | a | b
-------------+----+----+---
base_tbl | 1 | 10 | 5
base_tbl | 1 | 20 | 5
base_tbl | 2 | 0 | 5
foreign_tbl | 1 | 10 | 5
foreign_tbl | 1 | 20 | 5
foreign_tbl | 2 | 0 | 5
rw_view2 | 2 | 0 | 5
(7 rows)
insert into base_tbl values(1,100,99),(2,100,99);
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Delete on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Seq Scan on public.base_tbl
Output: ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
(12 rows)
delete from rw_view1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Delete on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Seq Scan on public.base_tbl
Output: ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
(12 rows)
delete from rw_view2 where id = 2;
select * from checkdata();
tbname | id | a | b
-------------+----+-----+----
base_tbl | 1 | 10 | 5
base_tbl | 1 | 20 | 5
base_tbl | 1 | 100 | 99
base_tbl | 2 | 100 | 99
foreign_tbl | 1 | 10 | 5
foreign_tbl | 1 | 20 | 5
foreign_tbl | 1 | 100 | 99
foreign_tbl | 2 | 100 | 99
(8 rows)
delete from base_tbl;
-- with trigger
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
SERVER loopback OPTIONS (table_name 'base_tbl');
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
-- WHERE a < b WITH CHECK OPTION;
-- \d+ rw_view
DROP FOREIGN TABLE foreign_tbl CASCADE;
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 0, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 16); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 0, 16
(3 rows)
INSERT INTO rw_view1 VALUES (1, 0, 16);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 0, 5
(3 rows)
INSERT INTO rw_view2 VALUES (2, 0, 5);
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 10, 5).
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 0, 16
(3 rows)
INSERT INTO rw_view2 VALUES (2, 0, 16);
select * from checkdata();
tbname | id | a | b
-------------+----+----+----
base_tbl | 1 | 10 | 5
base_tbl | 1 | 10 | 16
base_tbl | 2 | 10 | 16
foreign_tbl | 1 | 10 | 5
foreign_tbl | 1 | 10 | 16
foreign_tbl | 2 | 10 | 16
rw_view1 | 1 | 10 | 16
rw_view2 | 2 | 10 | 16
(8 rows)
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a - 1 where id = 1;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a - 1), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
(12 rows)
UPDATE rw_view1 SET a = a - 1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 1 where id = 1;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 1), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
(12 rows)
UPDATE rw_view1 SET a = a + 1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a - 10 where id = 2;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a - 10), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
(12 rows)
UPDATE rw_view2 SET a = a - 10 where id = 2;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 10 where id = 2;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 10), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
(12 rows)
UPDATE rw_view2 SET a = a + 10 where id = 2;
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 30, 16).
select * from checkdata();
tbname | id | a | b
-------------+----+----+----
base_tbl | 1 | 10 | 5
base_tbl | 1 | 19 | 16
base_tbl | 2 | 10 | 16
foreign_tbl | 1 | 10 | 5
foreign_tbl | 1 | 19 | 16
foreign_tbl | 2 | 10 | 16
rw_view2 | 2 | 10 | 16
(7 rows)
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
DROP TABLE base_tbl;
DROP FUNCTION row_before_insupd_trigfunc;
DROP FUNCTION checkdata;
DROP VIEW rw_view1 cascade;
DROP VIEW rw_view2 cascade;
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TABLE base_tbl CASCADE;
-- ======================================================================================================================================
-- TEST-MODULE: test serial columns (ie, sequence-based defaults)
-- --------------------------------------

View File

@ -1365,20 +1365,20 @@ SELECT * FROM ft1 t1 WHERE t1.c1 === t1.c2 order by t1.c2 limit 1;
-- case when expr
explain (verbose, costs off) select * from ft1 where case c1 when 1 then 0 end = 0;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Foreign Scan on public.ft1
Output: c1, c2, c3, c4, c5, c6, c7, c8
Node ID: 1
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
Remote SQL: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END) = 0::numeric))
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2, c3, c4, c5, c6, c7, c8 FROM "S 1"."T 1" WHERE (((CASE "C 1" WHEN 1 THEN 0 ELSE NULL::integer END) = 0))
Row Adapter
Output: "C 1", c2, c3, c4, c5, c6, c7, c8
-> CStore Scan on "S 1"."T 1"
Output: "C 1", c2, c3, c4, c5, c6, c7, c8
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0::numeric ELSE NULL::numeric END = 0::numeric)
Filter: (CASE "T 1"."C 1" WHEN 1 THEN 0 ELSE NULL::integer END = 0)
(13 rows)
@ -7089,25 +7089,166 @@ CONTEXT: Remote SQL command: SELECT "C 1", c2, c3, c4, c5, c6, c7, c8, ctid, ta
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
ERROR: constraint "ft1_c2negative" of relation "ft1" does not exist
-- ======================================================================================================================================
-- TEST-MODULE: WITH CHECK OPTION constraints
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
-- --------------------------------------
-- openGauss not support WITH CHECK OPTION, so this test module
-- is unuseful.
-- ======================================================================================================================================
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TABLE base_tbl (a int, b int) with (orientation=column);
CREATE TABLE base_tbl (id int, a int, b int) with (orientation=column);
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
\d+ rw_view1
View "public.rw_view1"
Column | Type | Modifiers | Storage | Description
--------+---------+-----------+---------+-------------
id | integer | | plain |
a | integer | | plain |
b | integer | | plain |
View definition:
SELECT *
FROM foreign_tbl
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 1;
\d+ rw_view2
View "public.rw_view2"
Column | Type | Modifiers | Storage | Description
--------+---------+-----------+---------+-------------
id | integer | | plain |
a | integer | | plain |
b | integer | | plain |
View definition:
SELECT *
FROM foreign_tbl
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 2;
Options: check_option=cascaded
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
select * from (
(select 'rw_view1', * from rw_view1 where id = 1) union all
(select 'rw_view2', * from rw_view2 where id = 2) union all
(select 'base_tbl', * from base_tbl) union all
(select 'foreign_tbl', * from foreign_tbl)
) data(tbname, id, a, b)
order by 1,2,3,4;
$$ language sql;
-- simple case
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 0, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 10, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 10, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 0, 5
(3 rows)
INSERT INTO rw_view2 VALUES (2, 0, 5);
ERROR: Un-support feature
DETAIL: column stored relation doesn't support INSERT returning
CONTEXT: Remote SQL command: INSERT INTO public.base_tbl(id, a, b) VALUES ($1, $2, $3) RETURNING id, a, b
select * from checkdata();
tbname | id | a | b
-------------+----+----+---
base_tbl | 1 | 0 | 5
base_tbl | 1 | 10 | 5
foreign_tbl | 1 | 0 | 5
foreign_tbl | 1 | 10 | 5
rw_view1 | 1 | 0 | 5
(5 rows)
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Row Adapter
Output: id, a, b, ctid, tableoid
-> CStore Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
(14 rows)
UPDATE rw_view1 SET a = a + 20 where id = 1;
select * from checkdata();
tbname | id | a | b
-------------+----+----+---
base_tbl | 1 | 10 | 5
base_tbl | 1 | 20 | 5
foreign_tbl | 1 | 10 | 5
foreign_tbl | 1 | 20 | 5
(4 rows)
insert into base_tbl values(1,100,99),(2,100,99);
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Delete on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Row Adapter
Output: ctid, tableoid
-> CStore Scan on public.base_tbl
Output: ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
(14 rows)
delete from rw_view1 where id = 1;
select * from checkdata();
tbname | id | a | b
-------------+----+-----+----
base_tbl | 1 | 10 | 5
base_tbl | 1 | 20 | 5
base_tbl | 1 | 100 | 99
base_tbl | 2 | 100 | 99
foreign_tbl | 1 | 10 | 5
foreign_tbl | 1 | 20 | 5
foreign_tbl | 1 | 100 | 99
foreign_tbl | 2 | 100 | 99
(8 rows)
delete from base_tbl;
-- with trigger
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
ERROR: Only support CREATE TRIGGER on regular row table.
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
SERVER loopback OPTIONS (table_name 'base_tbl');
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
-- WHERE a < b WITH CHECK OPTION;
-- \d+ rw_view
DROP FOREIGN TABLE foreign_tbl CASCADE;
-- not support, do nothing
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
ERROR: trigger "row_before_insupd_trigger" for table "base_tbl" does not exist
DROP TABLE base_tbl;
DROP FUNCTION row_before_insupd_trigfunc;
DROP FUNCTION checkdata;
DROP VIEW rw_view1 cascade;
DROP VIEW rw_view2 cascade;
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TABLE base_tbl CASCADE;
-- ======================================================================================================================================
-- TEST-MODULE: test serial columns (ie, sequence-based defaults)
-- --------------------------------------

View File

@ -252,12 +252,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM ft6; --err
SELECT * FROM ft6;
c1 | c2 | c3
----+-----+--------
12 | 13 | AAA012
18 | 19 | AAA018
27 | 28 | AAA027
39 | 40 | AAA039
45 | 46 | AAA045
48 | 49 | AAA048
3 | 4 | AAA003
6 | 7 | AAA006
9 | 10 | AAA009
@ -268,12 +262,12 @@ SELECT * FROM ft6;
33 | 34 | AAA033
36 | 37 | AAA036
42 | 43 | AAA042
51 | 52 | AAA051
63 | 64 | AAA063
66 | 67 | AAA066
69 | 70 | AAA069
75 | 76 | AAA075
84 | 85 | AAA084
12 | 13 | AAA012
18 | 19 | AAA018
27 | 28 | AAA027
39 | 40 | AAA039
45 | 46 | AAA045
48 | 49 | AAA048
54 | 55 | AAA054
57 | 58 | AAA057
60 | 61 | AAA060
@ -285,6 +279,12 @@ SELECT * FROM ft6;
93 | 94 | AAA093
96 | 97 | AAA096
99 | 100 | AAA099
51 | 52 | AAA051
63 | 64 | AAA063
66 | 67 | AAA066
69 | 70 | AAA069
75 | 76 | AAA075
84 | 85 | AAA084
(33 rows)
SHOW sql_beta_feature;
@ -313,12 +313,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM ft6; --suc
SELECT * FROM ft6;
c1 | c2 | c3
----+-----+--------
12 | 13 | AAA012
18 | 19 | AAA018
27 | 28 | AAA027
39 | 40 | AAA039
45 | 46 | AAA045
48 | 49 | AAA048
3 | 4 | AAA003
6 | 7 | AAA006
9 | 10 | AAA009
@ -329,12 +323,12 @@ SELECT * FROM ft6;
33 | 34 | AAA033
36 | 37 | AAA036
42 | 43 | AAA042
51 | 52 | AAA051
63 | 64 | AAA063
66 | 67 | AAA066
69 | 70 | AAA069
75 | 76 | AAA075
84 | 85 | AAA084
12 | 13 | AAA012
18 | 19 | AAA018
27 | 28 | AAA027
39 | 40 | AAA039
45 | 46 | AAA045
48 | 49 | AAA048
54 | 55 | AAA054
57 | 58 | AAA057
60 | 61 | AAA060
@ -346,6 +340,12 @@ SELECT * FROM ft6;
93 | 94 | AAA093
96 | 97 | AAA096
99 | 100 | AAA099
51 | 52 | AAA051
63 | 64 | AAA063
66 | 67 | AAA066
69 | 70 | AAA069
75 | 76 | AAA075
84 | 85 | AAA084
(33 rows)
-- ======================================================================================================================================
@ -1931,10 +1931,10 @@ SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE
SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE c1 < 10) t2 ON (t1.c1 = t2.c1) WHERE t1.c1 < 10;
c1 | c2 | c1 | c2
----+----+----+----
4 | 5 | |
2 | 3 | |
6 | 7 | 6 | 7
8 | 9 | |
4 | 5 | |
(4 rows)
-- clauses within the nullable side are not pulled up, but the top level clause
@ -1980,10 +1980,10 @@ SELECT t1.c1, t1.c2, t2.c1, t2.c2 FROM ft4 t1 LEFT JOIN (SELECT * FROM ft5 WHERE
WHERE (t2.c1 < 10 OR t2.c1 IS NULL) AND t1.c1 < 10;
c1 | c2 | c1 | c2
----+----+----+----
4 | 5 | |
2 | 3 | |
6 | 7 | 6 | 7
8 | 9 | |
4 | 5 | |
(4 rows)
-- right outer join
@ -2492,7 +2492,7 @@ SELECT t1.c1, ss.a, ss.b FROM (SELECT c1 FROM "S 1"."T 3" WHERE c1 = 50) t1 INNE
-> Partitioned Index Scan using t3_pkey on "S 1"."T 3"
Output: "T 3".c1, "T 3".ctid, "T 3".tableoid
Index Cond: ("T 3".c1 = 50)
Selected Partitions: 1
Selected Partitions: 2
-> Hash Full Join
Output: ft4.c1, ft4.*, ft5.c1, ft5.*
Hash Cond: (ft4.c1 = ft5.c1)
@ -4058,9 +4058,9 @@ SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT
SELECT ft4.c1, q.* FROM ft4 LEFT JOIN (SELECT 13, ft1.c1, ft2.c1 FROM ft1 RIGHT JOIN ft2 ON (ft1.c1 = ft2.c1) WHERE ft1.c1 = 12) q(a, b, c) ON (ft4.c1 = q.b) WHERE ft4.c1 BETWEEN 10 AND 15;
c1 | a | b | c
----+----+----+----
12 | 13 | 12 | 12
10 | | |
14 | | |
12 | 13 | 12 | 12
(3 rows)
-- join with nullable side with some columns with null values
@ -5547,7 +5547,6 @@ create operator public.>^ (
procedure = int4gt
);
create operator family my_op_family using btree;
ERROR: user defined operator is not yet supported.
create function my_op_cmp(a int, b int) returns int as
$$begin return btint4cmp(a, b); end $$ language plpgsql;
create operator class my_op_class for type int using btree family my_op_family as
@ -5555,23 +5554,35 @@ create operator class my_op_class for type int using btree family my_op_family a
operator 3 public.=^,
operator 5 public.>^,
function 1 my_op_cmp(int, int);
ERROR: operator family "my_op_family" does not exist for access method "btree"
-- NOTICES:
-- openGauss not support create operator class. remove the case. If you want to restore the test case later, refer to README in the file header.
-- This will not be pushed as sort operator is now removed from the extension.
explain (verbose, costs off)
select array_agg(c1 order by c1 using operator(public.<^)) from ft2 where c2 = 6 and c1 < 100 group by c2;
ERROR: operator <^ is not a valid ordering operator
LINE 2: select array_agg(c1 order by c1 using operator(public.<^)) f...
^
HINT: Ordering operators must be "<" or ">" members of btree operator families.
CONTEXT: referenced column: array_agg
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------
GroupAggregate
Output: array_agg(c1 ORDER BY c1 USING <^ NULLS LAST), c2
Group By Key: ft2.c2
-> Foreign Scan on public.ft2
Output: c2, c1
Node ID: 1
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT "C 1", c2 FROM "S 1"."T 1" WHERE (("C 1" < 100)) AND ((c2 = 6))
Partitioned Index Scan using t1_pkey on "S 1"."T 1"
Output: "C 1", c2
Index Cond: ("T 1"."C 1" < 100)
Filter: ("T 1".c2 = 6)
Selected Partitions: 1
(16 rows)
-- Cleanup
drop operator class my_op_class using btree;
ERROR: operator class "my_op_class" does not exist for access method "btree"
drop function my_op_cmp(a int, b int);
drop operator family my_op_family using btree;
ERROR: operator family "my_op_family" does not exist for access method "btree"
drop operator public.>^(int, int);
drop operator public.=^(int, int);
drop operator public.<^(int, int);
@ -6788,6 +6799,459 @@ SELECT f_test(100);
DROP FUNCTION f_test(int);
-- ======================================================================================================================================
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
-- --------------------------------------
-- ======================================================================================================================================
CREATE TABLE base_tbl (id int, a int, b int)
partition by range(a) (partition a1 values less than(100), partition a2 values less than(200));
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
\d+ rw_view1
View "public.rw_view1"
Column | Type | Modifiers | Storage | Description
--------+---------+-----------+---------+-------------
id | integer | | plain |
a | integer | | plain |
b | integer | | plain |
View definition:
SELECT *
FROM foreign_tbl
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 1;
\d+ rw_view2
View "public.rw_view2"
Column | Type | Modifiers | Storage | Description
--------+---------+-----------+---------+-------------
id | integer | | plain |
a | integer | | plain |
b | integer | | plain |
View definition:
SELECT *
FROM foreign_tbl
WHERE foreign_tbl.a < foreign_tbl.b AND foreign_tbl.id = 2;
Options: check_option=cascaded
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
select * from (
(select 'rw_view1', * from rw_view1 where id = 1) union all
(select 'rw_view2', * from rw_view2 where id = 2) union all
(select 'base_tbl p1', * from base_tbl) union all
(select 'base_tbl p2', * from base_tbl) union all
(select 'foreign_tbl', * from foreign_tbl)
) data(tbname, id, a, b)
order by 1,2,3,4;
$$ language sql;
-- simple case
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 0, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 100, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 100, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 100, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 1000, 5000); -- should failed
QUERY PLAN
-------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 1000, 5000
(3 rows)
INSERT INTO rw_view1 VALUES (1, 1000, 5000);
ERROR: inserted partition key does not map to any table partition
CONTEXT: Remote SQL command: INSERT INTO public.base_tbl(id, a, b) VALUES ($1, $2, $3)
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 0, 5
(3 rows)
INSERT INTO rw_view2 VALUES (2, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 100, 5); -- should failed
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 100, 5
(3 rows)
INSERT INTO rw_view2 VALUES (2, 100, 5);
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 100, 5).
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 1000, 5000); -- should failed
QUERY PLAN
-------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 1000, 5000
(3 rows)
INSERT INTO rw_view2 VALUES (2, 1000, 5000);
ERROR: inserted partition key does not map to any table partition
CONTEXT: Remote SQL command: INSERT INTO public.base_tbl(id, a, b) VALUES ($1, $2, $3) RETURNING id, a, b
select * from checkdata();
tbname | id | a | b
-------------+----+-----+---
base_tbl p1 | 1 | 0 | 5
base_tbl p1 | 1 | 100 | 5
base_tbl p1 | 2 | 0 | 5
base_tbl p2 | 1 | 0 | 5
base_tbl p2 | 1 | 100 | 5
base_tbl p2 | 2 | 0 | 5
foreign_tbl | 1 | 0 | 5
foreign_tbl | 1 | 100 | 5
foreign_tbl | 2 | 0 | 5
rw_view1 | 1 | 0 | 5
rw_view2 | 2 | 0 | 5
(11 rows)
delete from base_tbl;
insert into base_tbl values(1, 65, 100), (2, 85, 100); -- in and cross partition update
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Partition Iterator
Output: id, a, b, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view1 SET a = a + 10 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Partition Iterator
Output: id, a, b, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view1 SET a = a + 10 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Partition Iterator
Output: id, a, b, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view2 SET a = a + 20 where id = 2;
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 105, 100).
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2; -- should success
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), 200, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Partition Iterator
Output: id, a, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2;
select * from checkdata();
tbname | id | a | b
-------------+----+-----+-----
base_tbl p1 | 1 | 85 | 100
base_tbl p1 | 2 | 105 | 200
base_tbl p2 | 1 | 85 | 100
base_tbl p2 | 2 | 105 | 200
foreign_tbl | 1 | 85 | 100
foreign_tbl | 2 | 105 | 200
rw_view1 | 1 | 85 | 100
rw_view2 | 2 | 105 | 200
(8 rows)
delete from base_tbl;
insert into base_tbl values(1, 100, 99),(2, 100, 99);
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Delete on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Partition Iterator
Output: ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
Selected Partitions: 1..2
(16 rows)
delete from rw_view1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Delete on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Partition Iterator
Output: ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
Selected Partitions: 1..2
(16 rows)
delete from rw_view2 where id = 2;
select * from checkdata();
tbname | id | a | b
-------------+----+-----+----
base_tbl p1 | 1 | 100 | 99
base_tbl p1 | 2 | 100 | 99
base_tbl p2 | 1 | 100 | 99
base_tbl p2 | 2 | 100 | 99
foreign_tbl | 1 | 100 | 99
foreign_tbl | 2 | 100 | 99
(6 rows)
delete from base_tbl;
-- with trigger
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 0, 5
(3 rows)
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 80, 16); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 1, 80, 16
(3 rows)
INSERT INTO rw_view1 VALUES (1, 80, 16);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 0, 5
(3 rows)
INSERT INTO rw_view2 VALUES (2, 0, 5);
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 10, 5).
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
QUERY PLAN
------------------------------
Insert on public.foreign_tbl
-> Result
Output: 2, 0, 16
(3 rows)
INSERT INTO rw_view2 VALUES (2, 0, 16);
select * from checkdata();
tbname | id | a | b
-------------+----+----+----
base_tbl p1 | 1 | 10 | 5
base_tbl p1 | 1 | 90 | 16
base_tbl p1 | 2 | 10 | 16
base_tbl p2 | 1 | 10 | 5
base_tbl p2 | 1 | 90 | 16
base_tbl p2 | 2 | 10 | 16
foreign_tbl | 1 | 10 | 5
foreign_tbl | 1 | 90 | 16
foreign_tbl | 2 | 10 | 16
rw_view2 | 2 | 10 | 16
(10 rows)
delete from base_tbl;
insert into base_tbl values(1, 50, 101), (2, 50, 120); -- in and cross partition update
-- (1, 60, 101), (2, 60, 120)
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Partition Iterator
Output: id, a, b, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view1 SET a = a +20 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 20), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 1))
Partition Iterator
Output: id, a, b, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 1))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view1 SET a = a +20 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 55 where id = 2; -- should failed
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 55), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Partition Iterator
Output: id, a, b, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view2 SET a = a + 55 where id = 2;
ERROR: new row violates WITH CHECK OPTION for view "rw_view2"
DETAIL: Failing row contains (2, 125, 120).
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 45 where id = 2; -- should success
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Update on public.foreign_tbl
-> Foreign Scan on public.foreign_tbl
Output: foreign_tbl.id, (foreign_tbl.a + 45), foreign_tbl.b, foreign_tbl.ctid, foreign_tbl.tableoid
Node ID: 1
Remote SQL: SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
FDW remote plans:
Node 1: EXPLAIN (VERBOSE ON, COSTS OFF) SELECT id, a, b, ctid, tableoid FROM public.base_tbl WHERE ((a < b)) AND ((id = 2))
Partition Iterator
Output: id, a, b, ctid, tableoid
Iterations: 2
-> Partitioned Seq Scan on public.base_tbl
Output: id, a, b, ctid, tableoid
Filter: ((base_tbl.a < base_tbl.b) AND (base_tbl.id = 2))
Selected Partitions: 1..2
(16 rows)
UPDATE rw_view2 SET a = a + 45 where id = 2;
select * from checkdata();
tbname | id | a | b
-------------+----+-----+-----
base_tbl p1 | 1 | 120 | 101
base_tbl p1 | 2 | 115 | 120
base_tbl p2 | 1 | 120 | 101
base_tbl p2 | 2 | 115 | 120
foreign_tbl | 1 | 120 | 101
foreign_tbl | 2 | 115 | 120
rw_view2 | 2 | 115 | 120
(7 rows)
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
DROP FUNCTION row_before_insupd_trigfunc;
DROP FUNCTION checkdata;
DROP VIEW rw_view1 cascade;
DROP VIEW rw_view2 cascade;
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TABLE base_tbl CASCADE;
-- ======================================================================================================================================
-- TEST-MODULE: test writable foreign table stuff
-- --------------------------------------
-- ======================================================================================================================================
@ -9183,12 +9647,6 @@ EXPLAIN (VERBOSE, COSTS OFF)select * from ftx;
select * from ftx;
c1 | c2 | c3
----+-----+--------
12 | 13 | AAA012
39 | 40 | AAA039
48 | 49 | AAA048
18 | 19 |
27 | 28 |
45 | 46 |
3 | 4 | AAA003
6 | 7 | AAA006
15 | 16 | AAA015
@ -9199,12 +9657,12 @@ select * from ftx;
42 | 43 | AAA042
9 | 10 |
36 | 37 |
51 | 52 | AAA051
66 | 67 | AAA066
69 | 70 | AAA069
75 | 76 | AAA075
84 | 85 | AAA084
63 | 64 |
12 | 13 | AAA012
39 | 40 | AAA039
48 | 49 | AAA048
18 | 19 |
27 | 28 |
45 | 46 |
57 | 58 | AAA057
60 | 61 | AAA060
78 | 79 | AAA078
@ -9216,6 +9674,12 @@ select * from ftx;
81 | 82 |
90 | 91 |
99 | 100 |
51 | 52 | AAA051
66 | 67 | AAA066
69 | 70 | AAA069
75 | 76 | AAA075
84 | 85 | AAA084
63 | 64 |
(33 rows)
EXPLAIN (VERBOSE, COSTS OFF)select * from ftx partition(ptb1); --ERR

View File

@ -274,6 +274,7 @@ ForeignPath *create_foreign_join_path(PlannerInfo *root, RelOptInfo *rel, List *
pathnode->path.pathtype = T_ForeignScan;
pathnode->path.parent = rel;
pathnode->path.pathtarget = rel->reltarget;
pathnode->path.param_info = NULL; /* XXX see above */
pathnode->path.rows = rows;
pathnode->path.startup_cost = startup_cost;
@ -346,7 +347,7 @@ RelOptInfo *fetch_upper_rel(FDWUpperRelCxt *ufdwCxt, UpperRelationKind kind)
upperrel->reloptkind = RELOPT_UPPER_REL;
upperrel->relids = NULL;
upperrel->reltargetlist = NIL;
upperrel->reltarget = makeNode(PathTarget);
upperrel->pathlist = NIL;
upperrel->cheapest_startup_path = NULL;
upperrel->cheapest_total_path = NULL;
@ -406,7 +407,7 @@ RelOptInfo *make_upper_rel(FDWUpperRelCxt *ufdwCxt, PgFdwRelationInfo *fpinfo)
RelOptInfo *upper_rel = fetch_upper_rel(ufdwCxt, fpinfo->stage);
/* Set target. */
upper_rel->reltargetlist = extract_target_from_tel(ufdwCxt, fpinfo);
upper_rel->reltarget->exprs = extract_target_from_tel(ufdwCxt, fpinfo);
/*
* If the input rel belongs to a single FDW, so does the grouped rel.
@ -463,6 +464,7 @@ ForeignPath *create_foreign_upper_path(PlannerInfo *root, RelOptInfo *rel, List
pathnode->path.pathtype = T_ForeignScan;
pathnode->path.parent = rel;
pathnode->path.pathtarget = rel->reltarget;
pathnode->path.param_info = NULL;
pathnode->path.rows = rows;
pathnode->path.startup_cost = startup_cost;

View File

@ -420,7 +420,7 @@ static void postgresGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oi
* columns used in them. Doesn't seem worth detecting that case though.)
*/
fpinfo->attrs_used = NULL;
pull_varattnos((Node *)baserel->reltargetlist, baserel->relid, &fpinfo->attrs_used);
pull_varattnos((Node *)baserel->reltarget->exprs, baserel->relid, &fpinfo->attrs_used);
foreach (lc, fpinfo->local_conds) {
RestrictInfo *rinfo = (RestrictInfo *)lfirst(lc);
@ -463,7 +463,7 @@ static void postgresGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oi
/* Report estimated baserel size to planner. */
baserel->rows = fpinfo->rows;
baserel->width = fpinfo->width;
baserel->reltarget->width = fpinfo->width;
} else {
/*
* If the foreign table has never been ANALYZEd, it will have relpages
@ -476,7 +476,7 @@ static void postgresGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oi
*/
if (baserel->pages == 0 && baserel->tuples == 0) {
baserel->pages = 10;
baserel->tuples = (double)(10 * BLCKSZ) / (baserel->width + sizeof(HeapTupleHeaderData));
baserel->tuples = (double)(10 * BLCKSZ) / (baserel->reltarget->width + sizeof(HeapTupleHeaderData));
}
/* Estimate baserel size as best we can with local statistics. */
@ -1300,6 +1300,7 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
RangeTblEntry *rte = planner_rt_fetch(resultRelation, root);
StringInfoData sql;
List *targetAttrs = NIL;
List *withCheckOptionList = NIL;
List *returningList = NIL;
List *retrieved_attrs = NIL;
@ -1327,7 +1328,7 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
int attnum;
for (attnum = 1; attnum <= tupdesc->natts; attnum++) {
Form_pg_attribute attr = tupdesc->attrs[attnum - 1];
Form_pg_attribute attr = &tupdesc->attrs[attnum - 1];
if (!attr->attisdropped) {
targetAttrs = lappend_int(targetAttrs, attnum);
@ -1347,6 +1348,13 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
}
}
/*
* Extract the relevant WITH CHECK OPTION list if any.
*/
if (plan->withCheckOptionLists) {
withCheckOptionList = (List*)list_nth(plan->withCheckOptionLists, subplan_index);
}
/*
* Extract the relevant RETURNING list if any.
*/
@ -1359,10 +1367,12 @@ static List *postgresPlanForeignModify(PlannerInfo *root, ModifyTable *plan, Ind
*/
switch (operation) {
case CMD_INSERT:
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, returningList, &retrieved_attrs);
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, withCheckOptionList, returningList,
&retrieved_attrs);
break;
case CMD_UPDATE:
deparseUpdateSql(&sql, rte, resultRelation, rel, targetAttrs, returningList, &retrieved_attrs);
deparseUpdateSql(&sql, rte, resultRelation, rel, targetAttrs, withCheckOptionList, returningList,
&retrieved_attrs);
break;
case CMD_DELETE:
deparseDeleteSql(&sql, rte, resultRelation, rel, returningList, &retrieved_attrs);
@ -1492,7 +1502,7 @@ static PgFdwModifyState *createForeignModify(EState *estate, RangeTblEntry *rte,
/* Set up for remaining transmittable parameters */
foreach (lc, fmstate->target_attrs) {
int attnum = lfirst_int(lc);
Form_pg_attribute attr = tupdesc->attrs[attnum - 1];
Form_pg_attribute attr = &tupdesc->attrs[attnum - 1];
Assert(!attr->attisdropped);
@ -1529,13 +1539,13 @@ static TupleTableSlot *postgresExecForeignInsert(EState *estate, ResultRelInfo *
initStringInfo(&sql);
/* We transmit all columns that are defined in the foreign table. */
for (int attnum = 1; attnum <= tupdesc->natts; attnum++) {
Form_pg_attribute attr = tupdesc->attrs[attnum - 1];
Form_pg_attribute attr = &tupdesc->attrs[attnum - 1];
if (!attr->attisdropped) {
targetAttrs = lappend_int(targetAttrs, attnum);
}
}
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, NULL, &retrieved_attrs);
deparseInsertSql(&sql, rte, resultRelation, rel, targetAttrs, NULL, NULL, &retrieved_attrs);
fmstate = createForeignModify(estate, rte, resultRelInfo, CMD_INSERT, NULL, sql.data, targetAttrs,
retrieved_attrs != NIL, retrieved_attrs);
@ -2098,7 +2108,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
/* Use rows/width estimates made by the core code. */
rows = foreignrel->rows;
width = foreignrel->width;
width = foreignrel->reltarget->width;
/* For join we expect inner and outer relations set */
Assert(fpinfo->innerrel && fpinfo->outerrel);
@ -2189,7 +2199,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
/* Collect statistics about aggregates for estimating costs. */
MemSet(&aggcosts, 0, sizeof(AggClauseCosts));
if (root->parse->hasAggs) {
count_agg_clauses(root, (Node*)foreignrel->reltargetlist, &aggcosts);
count_agg_clauses(root, (Node*)foreignrel->reltarget->exprs, &aggcosts);
count_agg_clauses(root, root->parse->havingQual, &aggcosts);
}
@ -2216,7 +2226,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
}
/* Use width estimate made by the core code. */
width = foreignrel->width;
width = foreignrel->reltarget->width;
/* -----
* Startup cost includes:
@ -2259,7 +2269,7 @@ static void estimate_path_cost_size(PlannerInfo *root, RelOptInfo *foreignrel, L
/* Use rows/width estimates made by set_baserel_size_estimates. */
rows = foreignrel->rows;
width = foreignrel->width;
width = foreignrel->reltarget->width;
/*
* Back into an estimate of the number of retrieved rows. Just in
@ -3953,7 +3963,7 @@ static void postgresGetForeignJoinPaths(PlannerInfo *root, RelOptInfo *joinrel,
estimate_path_cost_size(root, joinrel, NIL, NIL, NULL, &rows, &width, &startup_cost, &total_cost);
/* Now update this information in the joinrel */
joinrel->rows = rows;
joinrel->width = width;
joinrel->reltarget->width = width;
fpinfo->rows = rows;
fpinfo->width = width;
fpinfo->startup_cost = startup_cost;
@ -4218,7 +4228,7 @@ static void init_upperrel_paths_context(FDWUpperRelCxt* ufdwCxt, Plan* mainPlan)
fpinfo->stage = UPPERREL_INIT;
/* the reltargetlist may bave been evaluted, we shoule adept it. */
ufdwCxt->currentRel->reltargetlist = extract_target_from_tel(ufdwCxt, fpinfo);
ufdwCxt->currentRel->reltarget->exprs = extract_target_from_tel(ufdwCxt, fpinfo);
ufdwCxt->state = FDW_UPPER_REL_INIT;
}
@ -4388,7 +4398,7 @@ static void add_foreign_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
fpinfo->total_cost = total_cost;
/* Create and add foreign path to the grouping relation. */
grouppath = create_foreign_upper_path(root, grouped_rel, grouped_rel->reltargetlist, rows, startup_cost, total_cost,
grouppath = create_foreign_upper_path(root, grouped_rel, grouped_rel->reltarget->exprs, rows, startup_cost, total_cost,
NIL, /* no pathkeys */
NULL, NIL); /* no fdw_private */
@ -4491,7 +4501,7 @@ static void add_foreign_ordered_paths(PlannerInfo *root, RelOptInfo *input_rel,
/* Construct PgFdwPathExtraData */
fpextra = (PgFdwPathExtraData *)palloc0(sizeof(PgFdwPathExtraData));
fpextra->target = ordered_rel->reltargetlist;
fpextra->target = ordered_rel->reltarget->exprs;
fpextra->has_final_sort = true;
/* Estimate the costs of performing the final sort remotely */
@ -4505,7 +4515,7 @@ static void add_foreign_ordered_paths(PlannerInfo *root, RelOptInfo *input_rel,
fdw_private = list_make2(makeInteger(1), makeInteger(0));
/* Create foreign ordering path */
ordered_path = create_foreign_upper_path(root, input_rel, ordered_rel->reltargetlist, rows, startup_cost,
ordered_path = create_foreign_upper_path(root, input_rel, ordered_rel->reltarget->exprs, rows, startup_cost,
total_cost, root->sort_pathkeys, NULL, /* no extra plan */
fdw_private);

View File

@ -151,9 +151,9 @@ extern void classifyConditions(PlannerInfo *root, RelOptInfo *baserel, List *inp
extern bool is_foreign_expr(PlannerInfo *root, RelOptInfo *baserel, Expr *expr);
extern bool is_foreign_pathkey(PlannerInfo *root, RelOptInfo *baserel, PathKey *pathkey);
extern void deparseInsertSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
List *returningList, List **retrieved_attrs);
List *withCheckOptionList, List *returningList, List **retrieved_attrs);
extern void deparseUpdateSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *targetAttrs,
List *returningList, List **retrieved_attrs);
List *withCheckOptionList, List *returningList, List **retrieved_attrs);
extern void deparseDeleteSql(StringInfo buf, RangeTblEntry *rte, Index rtindex, Relation rel, List *returningList,
List **retrieved_attrs);
extern void deparseAnalyzeSizeSql(StringInfo buf, Relation rel);

View File

@ -1371,24 +1371,85 @@ UPDATE ft1 SET c2 = c2 + 1 WHERE c1 = 1;
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
-- ======================================================================================================================================
-- TEST-MODULE: WITH CHECK OPTION constraints
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
-- --------------------------------------
-- openGauss not support WITH CHECK OPTION, so this test module is unuseful and cannot be fixed, remove it.
-- ======================================================================================================================================
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TABLE base_tbl (a int, b int);
CREATE TABLE base_tbl (id int, a int, b int);
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
SERVER loopback OPTIONS (table_name 'base_tbl');
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
-- WHERE a < b WITH CHECK OPTION;
-- \d+ rw_view
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
\d+ rw_view1
\d+ rw_view2
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
select * from (
(select 'rw_view1', * from rw_view1 where id = 1) union all
(select 'rw_view2', * from rw_view2 where id = 2) union all
(select 'base_tbl', * from base_tbl) union all
(select 'foreign_tbl', * from foreign_tbl)
) data(tbname, id, a, b)
order by 1,2,3,4;
$$ language sql;
-- simple case
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 10, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
INSERT INTO rw_view2 VALUES (2, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 10, 5); -- should failed
INSERT INTO rw_view2 VALUES (2, 10, 5);
select * from checkdata();
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
UPDATE rw_view1 SET a = a + 20 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
UPDATE rw_view2 SET a = a + 20 where id = 2;
select * from checkdata();
insert into base_tbl values(1,100,99),(2,100,99);
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
delete from rw_view1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
delete from rw_view2 where id = 2;
select * from checkdata();
delete from base_tbl;
-- with trigger
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 16); -- should success
INSERT INTO rw_view1 VALUES (1, 0, 16);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
INSERT INTO rw_view2 VALUES (2, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
INSERT INTO rw_view2 VALUES (2, 0, 16);
select * from checkdata();
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a - 1 where id = 1;
UPDATE rw_view1 SET a = a - 1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 1 where id = 1;
UPDATE rw_view1 SET a = a + 1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a - 10 where id = 2;
UPDATE rw_view2 SET a = a - 10 where id = 2;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 10 where id = 2;
UPDATE rw_view2 SET a = a + 10 where id = 2;
select * from checkdata();
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
DROP TABLE base_tbl;
DROP FUNCTION row_before_insupd_trigfunc;
DROP FUNCTION checkdata;
DROP VIEW rw_view1 cascade;
DROP VIEW rw_view2 cascade;
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TABLE base_tbl CASCADE;
-- ======================================================================================================================================

View File

@ -1008,26 +1008,59 @@ UPDATE ft1 SET c2 = c2 + 1 WHERE c1 = 1;
ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c2negative;
-- ======================================================================================================================================
-- TEST-MODULE: WITH CHECK OPTION constraints
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
-- --------------------------------------
-- openGauss not support WITH CHECK OPTION, so this test module
-- is unuseful.
-- ======================================================================================================================================
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TABLE base_tbl (a int, b int) with (orientation=column);
CREATE TABLE base_tbl (id int, a int, b int) with (orientation=column);
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
CREATE FOREIGN TABLE foreign_tbl (a int, b int)
SERVER loopback OPTIONS (table_name 'base_tbl');
-- CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
-- WHERE a < b WITH CHECK OPTION;
-- \d+ rw_view
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
\d+ rw_view1
\d+ rw_view2
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
select * from (
(select 'rw_view1', * from rw_view1 where id = 1) union all
(select 'rw_view2', * from rw_view2 where id = 2) union all
(select 'base_tbl', * from base_tbl) union all
(select 'foreign_tbl', * from foreign_tbl)
) data(tbname, id, a, b)
order by 1,2,3,4;
$$ language sql;
-- simple case
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 10, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 10, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
INSERT INTO rw_view2 VALUES (2, 0, 5);
select * from checkdata();
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
UPDATE rw_view1 SET a = a + 20 where id = 1;
select * from checkdata();
insert into base_tbl values(1,100,99),(2,100,99);
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
delete from rw_view1 where id = 1;
select * from checkdata();
delete from base_tbl;
-- with trigger
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
-- not support, do nothing
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
DROP TABLE base_tbl;
DROP FUNCTION row_before_insupd_trigfunc;
DROP FUNCTION checkdata;
DROP VIEW rw_view1 cascade;
DROP VIEW rw_view2 cascade;
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TABLE base_tbl CASCADE;
-- ======================================================================================================================================
-- TEST-MODULE: test serial columns (ie, sequence-based defaults)

View File

@ -1053,6 +1053,101 @@ $$ LANGUAGE plpgsql;
SELECT f_test(100);
DROP FUNCTION f_test(int);
-- ======================================================================================================================================
-- TEST-MODULE: IUD VIEW and WITH CHECK OPTION constraints
-- --------------------------------------
-- ======================================================================================================================================
CREATE TABLE base_tbl (id int, a int, b int)
partition by range(a) (partition a1 values less than(100), partition a2 values less than(200));
ALTER TABLE base_tbl SET (autovacuum_enabled = 'false');
CREATE FOREIGN TABLE foreign_tbl (id int, a int, b int) SERVER loopback OPTIONS (table_name 'base_tbl');
CREATE VIEW rw_view1 AS SELECT * FROM foreign_tbl WHERE a < b and id = 1;
CREATE VIEW rw_view2 AS SELECT * FROM foreign_tbl WHERE a < b and id = 2 WITH CHECK OPTION;
\d+ rw_view1
\d+ rw_view2
CREATE OR REPLACE FUNCTION checkdata(out tbname text, out id int, out a int, out b int) RETURNS SETOF record as $$
select * from (
(select 'rw_view1', * from rw_view1 where id = 1) union all
(select 'rw_view2', * from rw_view2 where id = 2) union all
(select 'base_tbl p1', * from base_tbl) union all
(select 'base_tbl p2', * from base_tbl) union all
(select 'foreign_tbl', * from foreign_tbl)
) data(tbname, id, a, b)
order by 1,2,3,4;
$$ language sql;
-- simple case
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 100, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 100, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 1000, 5000); -- should failed
INSERT INTO rw_view1 VALUES (1, 1000, 5000);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should success
INSERT INTO rw_view2 VALUES (2, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 100, 5); -- should failed
INSERT INTO rw_view2 VALUES (2, 100, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 1000, 5000); -- should failed
INSERT INTO rw_view2 VALUES (2, 1000, 5000);
select * from checkdata();
delete from base_tbl;
insert into base_tbl values(1, 65, 100), (2, 85, 100); -- in and cross partition update
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
UPDATE rw_view1 SET a = a + 10 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
UPDATE rw_view1 SET a = a + 10 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20 where id = 2; -- should failed
UPDATE rw_view2 SET a = a + 20 where id = 2;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2; -- should success
UPDATE rw_view2 SET a = a + 20, b = 200 where id = 2;
select * from checkdata();
delete from base_tbl;
insert into base_tbl values(1, 100, 99),(2, 100, 99);
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view1 where id = 1;
delete from rw_view1 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) delete from rw_view2 where id = 2;
delete from rw_view2 where id = 2;
select * from checkdata();
delete from base_tbl;
-- with trigger
CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN NEW.a := NEW.a + 10; RETURN NEW; END$$ LANGUAGE plpgsql;
CREATE TRIGGER row_before_insupd_trigger BEFORE INSERT OR UPDATE ON base_tbl FOR EACH ROW EXECUTE PROCEDURE row_before_insupd_trigfunc();
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 0, 5); -- should success
INSERT INTO rw_view1 VALUES (1, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view1 VALUES (1, 80, 16); -- should success
INSERT INTO rw_view1 VALUES (1, 80, 16);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 5); -- should failed
INSERT INTO rw_view2 VALUES (2, 0, 5);
EXPLAIN (VERBOSE, COSTS OFF) INSERT INTO rw_view2 VALUES (2, 0, 16); -- should success
INSERT INTO rw_view2 VALUES (2, 0, 16);
select * from checkdata();
delete from base_tbl;
insert into base_tbl values(1, 50, 101), (2, 50, 120); -- in and cross partition update
-- (1, 60, 101), (2, 60, 120)
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
UPDATE rw_view1 SET a = a +20 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view1 SET a = a + 20 where id = 1; -- should success
UPDATE rw_view1 SET a = a +20 where id = 1;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 55 where id = 2; -- should failed
UPDATE rw_view2 SET a = a + 55 where id = 2;
EXPLAIN (VERBOSE, COSTS OFF) UPDATE rw_view2 SET a = a + 45 where id = 2; -- should success
UPDATE rw_view2 SET a = a + 45 where id = 2;
select * from checkdata();
DROP TRIGGER row_before_insupd_trigger ON base_tbl;
DROP FUNCTION row_before_insupd_trigfunc;
DROP FUNCTION checkdata;
DROP VIEW rw_view1 cascade;
DROP VIEW rw_view2 cascade;
DROP FOREIGN TABLE foreign_tbl CASCADE;
DROP TABLE base_tbl CASCADE;
-- ======================================================================================================================================
-- TEST-MODULE: test writable foreign table stuff
-- --------------------------------------

View File

@ -515,30 +515,6 @@ void set_result_set_function(const PolicyLabelItem &func)
}
}
/*
* check exchange partition list contains masked table.
* For given AlterTableCmd list, check whether ordinary
* tables have bound masking policies.
*/
static bool exchange_partition_with_masked_table(List *cmds)
{
if (cmds == NIL) {
return false;
}
ListCell *lc = NULL;
foreach (lc, cmds) {
AlterTableCmd *cmd = (AlterTableCmd*)lfirst(lc);
if (cmd->subtype == AT_ExchangePartition && cmd->exchange_with_rel != NULL) {
Oid relid = RangeVarGetRelid(cmd->exchange_with_rel, NoLock, true);
if (is_masked_relation(relid)) {
return true;
}
}
}
return false;
}
static void gsaudit_next_PostParseAnalyze_hook(ParseState *pstate, Query *query)
{
/* do nothing when enable_security_policy is off */
@ -652,9 +628,24 @@ static void gsaudit_next_PostParseAnalyze_hook(ParseState *pstate, Query *query)
/* For ALTER TABLE EXCHANGE, will not allowed if the ordinary table(it's columns) has masking policy.*/
if (query->utilityStmt != NULL && nodeTag(query->utilityStmt) == T_AlterTableStmt) {
AlterTableStmt *alter_table = (AlterTableStmt *)(query->utilityStmt);
if (exchange_partition_with_masked_table(alter_table->cmds)) {
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("ALTER TABLE EXCHANGE can not execute with masked ordinary table.")));
Oid relid = RangeVarGetRelid(alter_table->relation, NoLock, true);
ListCell *lc = NULL;
foreach (lc, alter_table->cmds) {
AlterTableCmd *cmd = (AlterTableCmd *)lfirst(lc);
if (cmd->subtype == AT_ExchangePartition) {
Assert(PointerIsValid(cmd->exchange_with_rel));
if (is_masked_relation(relid)) {
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ALTER TABLE EXCHANGE can not execute with masked partition table.")));
}
Oid ordTableOid = RangeVarGetRelid(cmd->exchange_with_rel, NoLock, true);
if (is_masked_relation(ordTableOid)) {
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ALTER TABLE EXCHANGE can not execute with masked ordinary table.")));
}
}
}
}
break;
@ -814,19 +805,19 @@ static void light_unified_audit_executor(const Query *query)
access_audit_policy_run(query->rtable, query->commandType);
}
static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString, ParamListInfoData *params,
bool isTopLevel, DestReceiver *dest, bool sentToRemote, char *completionTag, bool isCTAS = false)
static void gsaudit_ProcessUtility_hook(processutility_context* processutility_cxt,
DestReceiver *dest, bool sentToRemote, char *completionTag, ProcessUtilityContext context,bool isCTAS = false)
{
/* do nothing when enable_security_policy is off */
if (!u_sess->attr.attr_security.Enable_Security_Policy || !IsConnFromApp() ||
u_sess->proc_cxt.IsInnerMaintenanceTools || IsConnFromCoord() ||
!is_audit_policy_exist_load_policy_info()) {
if (next_ProcessUtility_hook) {
next_ProcessUtility_hook(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
false);
next_ProcessUtility_hook(processutility_cxt, dest, sentToRemote, completionTag,
context, false);
} else {
standard_ProcessUtility(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
false);
standard_ProcessUtility(processutility_cxt, dest, sentToRemote, completionTag,
context, false);
}
return;
}
@ -840,6 +831,7 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
checkSecurityPolicyFilter_hook(filter_item, &security_policy_ids);
}
RenameMap renamed_objects;
Node* parsetree = processutility_cxt->parse_tree;
if (parsetree != NULL) {
switch (nodeTag(parsetree)) {
case T_PlannedStmt: {
@ -1618,11 +1610,11 @@ static void gsaudit_ProcessUtility_hook(Node *parsetree, const char *queryString
PG_TRY();
{
if (next_ProcessUtility_hook) {
next_ProcessUtility_hook(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
false);
next_ProcessUtility_hook(processutility_cxt, dest, sentToRemote, completionTag,
context, false);
} else {
standard_ProcessUtility(parsetree, queryString, params, isTopLevel, dest, sentToRemote, completionTag,
false);
standard_ProcessUtility(processutility_cxt, dest, sentToRemote, completionTag,
context, false);
}
flush_access_logs(AUDIT_OK);
send_mng_events(AUDIT_OK);

View File

@ -242,7 +242,7 @@ static void sepgsql_executor_start(QueryDesc* queryDesc, int eflags)
* It tries to rough-grained control on utility commands; some of them can
* break whole of the things if nefarious user would use.
*/
static void sepgsql_utility_command(Node* parsetree, const char* queryString, ParamListInfo params, bool isTopLevel,
static void sepgsql_utility_command(processutility_context* processutility_cxt,
DestReceiver* dest,
#ifdef PGXC
bool sentToRemote,
@ -251,6 +251,7 @@ static void sepgsql_utility_command(Node* parsetree, const char* queryString, Pa
{
sepgsql_context_info_t saved_context_info = sepgsql_context_info;
ListCell* cell = NULL;
Node* parsetree = processutility_cxt->parse_tree;
PG_TRY();
{
@ -300,20 +301,14 @@ static void sepgsql_utility_command(Node* parsetree, const char* queryString, Pa
}
if (next_ProcessUtility_hook)
(*next_ProcessUtility_hook)(parsetree,
queryString,
params,
isTopLevel,
(*next_ProcessUtility_hook)(processutility_cxt,
dest,
#ifdef PGXC
sentToRemote,
#endif
completionTag);
else
standard_ProcessUtility(parsetree,
queryString,
params,
isTopLevel,
standard_ProcessUtility(processutility_cxt,
dest,
#ifdef PGXC
sentToRemote,

View File

@ -312,7 +312,7 @@ Datum /* have to return HeapTuple to Executor */
snprintf(sql, sizeof(sql), "INSERT INTO %s VALUES (", relname);
for (i = 1; i <= natts; i++) {
ctypes[i - 1] = SPI_gettypeid(tupdesc, i);
if (!(tupdesc->attrs[i - 1]->attisdropped)) /* skip dropped columns */
if (!(tupdesc->attrs[i - 1].attisdropped)) /* skip dropped columns */
{
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%c$%d", separ, i);
separ = ',';

View File

@ -286,7 +286,7 @@ static void print_literal(StringInfo s, Oid typid, char* outputstr)
/*
* Decode tuple into stringinfo.
*/
static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple)
{
Assert(tuple != NULL);
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
@ -302,7 +302,7 @@ static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple,
Oid typoutput = 0; /* output function */
Datum origval = 0; /* possibly toasted Datum */
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
Form_pg_attribute attr = &tupdesc->attrs[natt]; /* the attribute itself */
if (attr->attisdropped || attr->attnum < 0) {
continue;
@ -315,10 +315,6 @@ static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple,
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
}
if (skip_nulls && isnull) {
continue;
}
/* query output function */
Oid typid = attr->atttypid; /* type of current attribute */
getTypeOutputInfo(typid, &typoutput, &typisvarlena);
@ -343,7 +339,7 @@ static void TupleToStringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple,
* Decode tuple into stringinfo.
* This function is used for UPDATE or DELETE statements.
*/
static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
static void TupleToStringinfoUpd(Relation relation, StringInfo s, TupleDesc tupdesc, HeapTuple tuple)
{
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
@ -358,9 +354,9 @@ static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tupl
bool isnull = false; /* column is null? */
bool typisvarlena = false;
Form_pg_attribute attr = tupdesc->attrs[natt]; /* the attribute itself */
Form_pg_attribute attr = &tupdesc->attrs[natt]; /* the attribute itself */
if (attr->attisdropped || attr->attnum < 0) {
if (attr->attisdropped || attr->attnum < 0 || !IsRelationReplidentKey(relation, attr->attnum)) {
continue;
}
@ -371,10 +367,6 @@ static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tupl
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
}
if (isnull && skip_nulls) {
continue;
}
if (!isFirstAtt) {
appendStringInfoString(s, " and ");
} else {
@ -403,31 +395,32 @@ static void TupleToStringinfoUpd(StringInfo s, TupleDesc tupdesc, HeapTuple tupl
* Callback for handle decoded tuple.
* Additional info will be added if the tuple is found null.
*/
static void TupleHandler(StringInfo s, TupleDesc tupdesc, ReorderBufferChange* change, bool isHeap, bool isNewTuple)
static void TupleHandler(Relation relation, StringInfo s, TupleDesc tupdesc, ReorderBufferChange* change,
bool isHeap, bool isNewTuple)
{
if (isHeap && isNewTuple) {
if (change->data.tp.newtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfo(s, tupdesc, &change->data.tp.newtuple->tuple, false);
TupleToStringinfo(s, tupdesc, &change->data.tp.newtuple->tuple);
}
} else if (isHeap && !isNewTuple) {
if (change->data.tp.oldtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfoUpd(s, tupdesc, &change->data.tp.oldtuple->tuple, true);
TupleToStringinfoUpd(relation, s, tupdesc, &change->data.tp.oldtuple->tuple);
}
} else if (!isHeap && isNewTuple) {
if (change->data.utp.newtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfo(s, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple), false);
TupleToStringinfo(s, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple));
}
} else {
if (change->data.utp.oldtuple == NULL) {
appendStringInfoString(s, " (no-tuple-data)");
} else {
TupleToStringinfoUpd(s, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple), true);
TupleToStringinfoUpd(relation, s, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple));
}
}
}
@ -472,7 +465,7 @@ static void pg_decode_change(
isHeap = false;
}
appendStringInfoString(ctx->out, " values ");
TupleHandler(ctx->out, tupdesc, change, isHeap, true);
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, true);
break;
case REORDER_BUFFER_CHANGE_UPDATE:
case REORDER_BUFFER_CHANGE_UUPDATE:
@ -483,12 +476,12 @@ static void pg_decode_change(
isHeap = false;
}
appendStringInfoString(ctx->out, " where ");
TupleHandler(ctx->out, tupdesc, change, isHeap, false);
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, false);
appendStringInfoChar(ctx->out, ';');
appendStringInfoString(ctx->out, "insert into ");
appendStringInfoString(ctx->out, quote_qualified_identifier(schema, table));
appendStringInfoString(ctx->out, " values ");
TupleHandler(ctx->out, tupdesc, change, isHeap, true);
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, true);
break;
@ -502,7 +495,7 @@ static void pg_decode_change(
}
appendStringInfoString(ctx->out, " where ");
TupleHandler(ctx->out, tupdesc, change, isHeap, false);
TupleHandler(relation, ctx->out, tupdesc, change, isHeap, false);
break;
default:
Assert(false);

View File

@ -1337,35 +1337,35 @@ static void validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch, bool
}
/* check that the types of the first two columns match */
if (tupdesc->attrs[0]->atttypid != tupdesc->attrs[1]->atttypid)
if (tupdesc->attrs[0].atttypid != tupdesc->attrs[1].atttypid)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid return type"),
errdetail("First two columns must be the same type.")));
/* check that the type of the third column is INT4 */
if (tupdesc->attrs[2]->atttypid != INT4OID)
if (tupdesc->attrs[2].atttypid != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid return type"),
errdetail("Third column must be type %s.", format_type_be(INT4OID))));
/* check that the type of the fourth column is TEXT if applicable */
if (show_branch && tupdesc->attrs[3]->atttypid != TEXTOID)
if (show_branch && tupdesc->attrs[3].atttypid != TEXTOID)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid return type"),
errdetail("Fourth column must be type %s.", format_type_be(TEXTOID))));
/* check that the type of the fifth column is INT4 */
if (show_branch && show_serial && tupdesc->attrs[4]->atttypid != INT4OID)
if (show_branch && show_serial && tupdesc->attrs[4].atttypid != INT4OID)
elog(ERROR,
"query-specified return tuple not valid for Connectby: "
"fifth column must be type %s",
format_type_be(INT4OID));
/* check that the type of the fifth column is INT4 */
if (!show_branch && show_serial && tupdesc->attrs[3]->atttypid != INT4OID)
if (!show_branch && show_serial && tupdesc->attrs[3].atttypid != INT4OID)
elog(ERROR,
"query-specified return tuple not valid for Connectby: "
"fourth column must be type %s",
@ -1383,8 +1383,8 @@ static bool compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupde
Oid sql_atttypid;
/* check the key_fld types match */
ret_atttypid = ret_tupdesc->attrs[0]->atttypid;
sql_atttypid = sql_tupdesc->attrs[0]->atttypid;
ret_atttypid = ret_tupdesc->attrs[0].atttypid;
sql_atttypid = sql_tupdesc->attrs[0].atttypid;
if (ret_atttypid != sql_atttypid)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
@ -1393,8 +1393,8 @@ static bool compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupde
"not match return key field datatype.")));
/* check the parent_key_fld types match */
ret_atttypid = ret_tupdesc->attrs[1]->atttypid;
sql_atttypid = sql_tupdesc->attrs[1]->atttypid;
ret_atttypid = ret_tupdesc->attrs[1].atttypid;
sql_atttypid = sql_tupdesc->attrs[1].atttypid;
if (ret_atttypid != sql_atttypid)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
@ -1421,8 +1421,8 @@ static bool compatCrosstabTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdes
return false;
/* check the rowid types match */
ret_atttypid = ret_tupdesc->attrs[0]->atttypid;
sql_atttypid = sql_tupdesc->attrs[0]->atttypid;
ret_atttypid = ret_tupdesc->attrs[0].atttypid;
sql_atttypid = sql_tupdesc->attrs[0].atttypid;
if (ret_atttypid != sql_atttypid)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),

View File

@ -199,15 +199,13 @@ static bool pg_decode_filter(LogicalDecodingContext* ctx, RepOriginId origin_id)
return true;
return false;
}
static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool skip_nulls)
static void tuple_to_stringinfo(Relation relation, StringInfo s, TupleDesc tupdesc, HeapTuple tuple, bool isOld)
{
if (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data))
if ((tuple->tupTableType == HEAP_TUPLE) && (HEAP_TUPLE_IS_COMPRESSED(tuple->t_data) ||
(int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) > tupdesc->natts)) {
return;
}
if ((int)HeapTupleHeaderGetNatts(tuple->t_data, tupdesc) != tupdesc->natts)
return;
int natt;
Oid oid;
/* print oid of tuple, it's not included in the TupleDesc */
@ -216,15 +214,14 @@ static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple
}
/* print all columns individually */
for (natt = 0; natt < tupdesc->natts; natt++) {
for (int natt = 0; natt < tupdesc->natts; natt++) {
Form_pg_attribute attr; /* the attribute itself */
Oid typid; /* type of current attribute */
Oid typoutput; /* output function */
bool typisvarlena = false;
Datum origval; /* possibly toasted Datum */
bool isnull = true; /* column is null? */
attr = tupdesc->attrs[natt];
attr = &tupdesc->attrs[natt];
/*
* don't print dropped columns, we can't be sure everything is
@ -237,16 +234,17 @@ static void tuple_to_stringinfo(StringInfo s, TupleDesc tupdesc, HeapTuple tuple
* Don't print system columns, oid will already have been printed if
* present.
*/
if (attr->attnum < 0)
if (attr->attnum < 0 || (isOld && !IsRelationReplidentKey(relation, attr->attnum)))
continue;
typid = attr->atttypid;
Oid typid = attr->atttypid; /* type of current attribute */
/* get Datum from tuple */
origval = heap_getattr(tuple, natt + 1, tupdesc, &isnull);
if (isnull && skip_nulls)
continue;
if (tuple->tupTableType == HEAP_TUPLE) {
origval = heap_getattr(tuple, natt + 1, tupdesc, &isnull);
} else {
origval = uheap_getattr((UHeapTuple)tuple, natt + 1, tupdesc, &isnull);
}
/* print attribute name */
appendStringInfoChar(s, ' ');
@ -327,20 +325,40 @@ static void pg_decode_change(
if (change->data.tp.newtuple == NULL)
appendStringInfoString(ctx->out, " (no-tuple-data)");
else
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
break;
case REORDER_BUFFER_CHANGE_UINSERT:
appendStringInfoString(ctx->out, " INSERT:");
if (change->data.utp.newtuple == NULL)
appendStringInfoString(ctx->out, " (no-tuple-data)");
else
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple), false);
break;
case REORDER_BUFFER_CHANGE_UPDATE:
appendStringInfoString(ctx->out, " UPDATE:");
if (change->data.tp.oldtuple != NULL) {
appendStringInfoString(ctx->out, " old-key:");
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
appendStringInfoString(ctx->out, " new-tuple:");
}
if (change->data.tp.newtuple == NULL)
appendStringInfoString(ctx->out, " (no-tuple-data)");
else
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.newtuple->tuple, false);
break;
case REORDER_BUFFER_CHANGE_UUPDATE:
appendStringInfoString(ctx->out, " UPDATE:");
if (change->data.utp.oldtuple != NULL) {
appendStringInfoString(ctx->out, " old-key:");
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple), true);
appendStringInfoString(ctx->out, " new-tuple:");
}
if (change->data.utp.newtuple == NULL)
appendStringInfoString(ctx->out, " (no-tuple-data)");
else
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.newtuple->tuple), false);
break;
case REORDER_BUFFER_CHANGE_DELETE:
appendStringInfoString(ctx->out, " DELETE:");
@ -350,7 +368,15 @@ static void pg_decode_change(
appendStringInfoString(ctx->out, " (no-tuple-data)");
/* In DELETE, only the replica identity is present; display that */
else
tuple_to_stringinfo(ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
tuple_to_stringinfo(relation, ctx->out, tupdesc, &change->data.tp.oldtuple->tuple, true);
break;
case REORDER_BUFFER_CHANGE_UDELETE:
appendStringInfoString(ctx->out, " DELETE:");
if (change->data.utp.oldtuple == NULL)
appendStringInfoString(ctx->out, " (no-tuple-data)");
else
tuple_to_stringinfo(relation, ctx->out, tupdesc, (HeapTuple)(&change->data.utp.oldtuple->tuple), true);
break;
default:
Assert(false);

View File

@ -1186,7 +1186,7 @@ su - gaussdb
the size of each individual file in the WAL log. It may be useful
to adjust this size to control the granularity of WAL log shipping.
The default size is 16 megabytes.
The value must be a power of 2 between 1 and 1024 (megabytes).
The value must be a power of 2 between 1 and 512 (megabytes).
Note that changing this value requires an gs_initdb.
</para>
</listitem>

View File

@ -12,6 +12,7 @@ Complete list of usable sgml source files in this directory.
<!ENTITY alterDatabase SYSTEM "alter_database.sgml">
<!ENTITY alterDefaultPrivileges SYSTEM "alter_default_privileges.sgml">
<!ENTITY alterDomain SYSTEM "alter_domain.sgml">
<!ENTITY alterEventTrigger SYSTEM "alter_event_trigger.sgml">
<!ENTITY alterExtension SYSTEM "alter_extension.sgml">
<!ENTITY alterForeignDataWrapper SYSTEM "alter_foreign_data_wrapper.sgml">
<!ENTITY alterForeignTable SYSTEM "alter_foreign_table.sgml">
@ -64,6 +65,7 @@ Complete list of usable sgml source files in this directory.
<!ENTITY createConversion SYSTEM "create_conversion.sgml">
<!ENTITY createDatabase SYSTEM "create_database.sgml">
<!ENTITY createDomain SYSTEM "create_domain.sgml">
<!ENTITY createEventTrigger SYSTEM "create_event_trigger.sgml">
<!ENTITY createExtension SYSTEM "create_extension.sgml">
<!ENTITY createForeignDataWrapper SYSTEM "create_foreign_data_wrapper.sgml">
<!ENTITY createForeignTable SYSTEM "create_foreign_table.sgml">
@ -108,6 +110,7 @@ Complete list of usable sgml source files in this directory.
<!ENTITY dropConversion SYSTEM "drop_conversion.sgml">
<!ENTITY dropDatabase SYSTEM "drop_database.sgml">
<!ENTITY dropDomain SYSTEM "drop_domain.sgml">
<!ENTITY dropEventTrigger SYSTEM "drop_event_trigger.sgml">
<!ENTITY dropExtension SYSTEM "drop_extension.sgml">
<!ENTITY dropForeignDataWrapper SYSTEM "drop_foreign_data_wrapper.sgml">
<!ENTITY dropForeignTable SYSTEM "drop_foreign_table.sgml">

View File

@ -0,0 +1,23 @@
<refentry id="SQL-ALTEREVENTTRIGGER">
<refmeta>
<refentrytitle>ALTER EVENT TRIGGER</refentrytitle>
<manvolnum>7</manvolnum>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ALTER EVENT TRIGGER</refname>
<refpurpose>change the definition of an event trigger</refpurpose>
</refnamediv>
<refsynopsisdiv>
<indexterm zone="sql-altereventtrigger">
<primary>ALTER EVENT TRIGGER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
ALTER EVENT TRIGGER name DISABLE
ALTER EVENT TRIGGER name ENABLE [ REPLICA | ALWAYS ]
ALTER EVENT TRIGGER name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER EVENT TRIGGER name RENAME TO new_name
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -15,6 +15,9 @@ ALTER SCHEMA schema_name
ALTER SCHEMA schema_name
OWNER TO new_owner;
ALTER SCHEMA schema_name {WITH | WITHOUT} BLOCKCHAIN;
ALTER SCHEMA schema_name
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ];
NOTICE: '[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -52,11 +52,18 @@ column_clause
| NO FORCE ROW LEVEL SECURITY
| ENCRYPTION KEY ROTATION
| AUTO_INCREMENT [ = ] value
| ALTER INDEX index_name [ VISBLE | INVISIBLE ]
| [ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]
| CONVERT TO CHARACTER SET | CHARSET charset [ COLLATE collation ]
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ COLLATE ]' is only available in CENTRALIZED mode and B-format database!
where column_clause can be:
ADD [ COLUMN ] column_name data_type [ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ]
ADD [ COLUMN ] column_name data_type [ CHARACTER SET | CHARSET charset ] [ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ] [ FIRST | AFTER column_name ]
| MODIFY column_name data_type
| MODIFY column_name [ CONSTRAINT constraint_name ] NOT NULL [ ENABLE ]
| MODIFY column_name [ CONSTRAINT constraint_name ] NULL
| MODIFY [ COLUMN ] column_name data_type [ CHARACTER SET | CHARSET charset ] [ COLLATE collation ] [ column_constraint [ ... ] ] [FIRST | AFTER column_name]
| CHANGE [ COLUMN ] column_name new_column_name data_type [ CHARACTER SET | CHARSET charset ] [ COLLATE collation ] [ column_constraint [ ... ] ] [FIRST | AFTER column_name]
| DROP [ COLUMN ] [ IF EXISTS ] column_name [ RESTRICT | CASCADE ]
| ALTER [ COLUMN ] column_name [ SET DATA ] TYPE data_type [ COLLATE collation ] [ USING expression ]
| ALTER [ COLUMN ] column_name { SET DEFAULT expression | DROP DEFAULT }
@ -67,27 +74,30 @@ ADD [ COLUMN ] column_name data_type [ compress_mode ] [ COLLATE collation ] [ c
| ALTER [ COLUMN ] column_name SET ( {attribute_option = value} [, ... ] )
| ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] )
| ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
NOTICE: 'MODIFY [ COLUMN ] ...' action is only available in CENTRALIZED mode and B-format database!
NOTICE: 'CHANGE [ COLUMN ] ...' action is only available in CENTRALIZED mode and B-format database!
where column_constraint can be:
[ CONSTRAINT constraint_name ]
{ NOT NULL |
NULL |
CHECK ( expression ) |
DEFAULT default_expr |
GENERATED ALWAYS AS ( generation_expr ) STORED |
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
AUTO_INCREMENT |
UNIQUE index_parameters |
UNIQUE [KEY] index_parameters |
PRIMARY KEY index_parameters |
ENCRYPTED WITH ( COLUMN_ENCRYPTION_KEY = column_encryption_key, ENCRYPTION_TYPE = encryption_type_value ) |
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
[ ON DELETE action ] [ ON UPDATE action ] }
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
where compress_mode can be:
{ DELTA | PREFIX | DICTIONARY | NUMSTR | NOCOMPRESS }
where table_constraint can be:
[ CONSTRAINT [ constraint_name ] ]
{ CHECK ( expression ) |
UNIQUE [ idx_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters |
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] }[, ... ] ) index_parameters |
UNIQUE [ idx_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] }[, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
PARTIAL CLUSTER KEY ( column_name [, ... ] ) |
FOREIGN KEY [ idx_name ] ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
[ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ] }
@ -101,11 +111,15 @@ where table_constraint_using_index can be:
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ FIRST | AFTER column_name ]' clause is only available in CENTRALIZED mode!
NOTICE: '[ FIRST | AFTER column_name ]' in 'MODIFY | CHANGE [ COLUMN ] ...' clause is only available in B-format database!
NOTICE: '[ CHARACTER SET | CHARSET charset ]' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ VISIBLE | INVISIBLE ]' is only avaliable in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -11,9 +11,7 @@
<refsynopsisdiv>
<synopsis>
ALTER TABLE [ IF EXISTS ] { table_name [*] | ONLY table_name | ONLY ( table_name )}
action [, ... ];
ALTER TABLE [ IF EXISTS ] { table_name [*] | ONLY table_name | ONLY ( table_name )}
RENAME PARTITION { partion_name | FOR ( partition_value [, ...] ) } TO partition_new_name;
{ action [, ... ] | rename_clause | reset_clause };
where action can be:
move_clause |
@ -30,16 +28,16 @@ MOVE PARTITION { partion_name | FOR ( partition_value [, ...] ) } TABLESPACE tab
where exchange_clause can be:
EXCHANGE PARTITION { ( partition_name ) | FOR ( partition_value [, ...] ) }
WITH TABLE {[ ONLY ] ordinary_table_name | ordinary_table_name * | ONLY ( ordinary_table_name )}
[ { WITH | WITHOUT } VALIDATION ] [ VERBOSE ]
[ { WITH | WITHOUT } VALIDATION ] [ VERBOSE ] [ UPDATE GLOBAL INDEX ]
where row_clause can be:
{ ENABLE | DISABLE } ROW MOVEMENT
where merge_clause can be:
MERGE PARTITIONS { partition_name } [, ...] INTO PARTITION partition_name
[ TABLESPACE tablespacename ]
[ TABLESPACE tablespacename ] [ UPDATE GLOBAL INDEX ]
where modify_clause can be:
MODIFY PARTITION partition_name { UNUSABLE LOCAL INDEXES | REBUILD UNUSABLE LOCAL INDEXES }
where split_clause can be:
SPLIT PARTITION { partition_name | FOR ( partition_value [, ...] ) } { split_point_clause | no_split_point_clause }
SPLIT PARTITION { partition_name | FOR ( partition_value [, ...] ) } { split_point_clause | no_split_point_clause } [ UPDATE GLOBAL INDEX ]
where split_point_clause can be:
AT ( partition_value ) INTO ( PARTITION partition_name [ TABLESPACE tablespacename ] , PARTITION partition_name [ TABLESPACE tablespacename ] )
where no_split_point_clause can be:
@ -60,10 +58,13 @@ PARTITION partition_name {
{END({partition_value | MAXVALUE})}
} [TABLESPACE tablespace_name]
where drop_clause can be:
DROP PARTITION { partition_name | FOR ( partition_value [, ...] ) }
DROP PARTITION { partition_name | FOR ( partition_value [, ...] ) } [ UPDATE GLOBAL INDEX ]
where truncate_clause can be:
TRUNCATE PARTITION { partition_name | FOR ( partition_value [, ...] ) } [ UPDATE GLOBAL INDEX ]
NOTICE: 'truncate_clause' is only avaliable in CENTRALIZED mode!
where rename_clause can be:
RENAME PARTITION { partion_name | FOR ( partition_value [, ...] ) } TO partition_new_name;
where reset_clause can be:
RESET PARTITION;
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -11,13 +11,16 @@
<refsynopsisdiv>
<synopsis>
ALTER TABLE [ IF EXISTS ] { table_name [*] | ONLY table_name | ONLY ( table_name )}
action [, ... ];
{ action [, ... ] | reset_clause };
where action can be:
row_clause |
add_clause |
drop_clause |
split_clause |
truncate_clause
where row_clause can be:
{ ENABLE | DISABLE } ROW MOVEMENT
where add_clause can be:
ADD { partition_less_than_item | partition_list_item } [ ( subpartition_definition_list ) ]
MODIFY PARTITION partition_name ADD subpartition_definition
@ -26,7 +29,7 @@ PARTITION partition_name VALUES LESS THAN ( partition_value | MAXVALUE ) [ TABLE
where partition_list_item can be:
PARTITION partition_name VALUES ( partition_value [, ...] | DEFAULT ) [ TABLESPACE tablespacename ]
where subpartition_definition_list can be:
SUBPARTITION subpartition_name [ VALUES LESS THAN ( partition_value | MAXVALUE ) | VALUES ( partition_value [, ...] | DEFAULT )] [ TABLESPACE tablespace ]
SUBPARTITION subpartition_name { VALUES LESS THAN ( partition_value | MAXVALUE ) | VALUES ( partition_value [, ...] | DEFAULT ) } [ TABLESPACE tablespace ]
where drop_clause can be:
DROP PARTITION { partition_name | FOR ( partition_value ) } [ UPDATE GLOBAL INDEX ]
DROP SUBPARTITION { subpartition_name | FOR ( partition_value, subpartition_value ) } [ UPDATE GLOBAL INDEX ]
@ -37,7 +40,8 @@ AT ( subpartition_value ) INTO ( SUBPARTITION subpartition_name [ TABLESPACE tab
VALUES ( subpartition_value ) INTO ( SUBPARTITION subpartition_name [ TABLESPACE tablespacename ] , SUBPARTITION subpartition_name [ TABLESPACE tablespacename ] )
where truncate_clause can be:
TRUNCATE SUBPARTITION { subpartition_name } [ UPDATE GLOBAL INDEX ]
NOTICE: 'ALTER TABLE SUBPARTITION' is only avaliable in CENTRALIZED mode!
where reset_clause can be:
RESET PARTITION;
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -14,7 +14,7 @@
[ table_name [ ( column_name [, ...] ) ] ];
{ANALYZE | ANALYSE} [ VERBOSE ]
[ table_name [ ( column_name [, ...] ) ] ]
PARTITION patrition_name;
PARTITION (partition_name);
{ANALYZE | ANALYSE} [ VERBOSE ]
{ foreign_table_name | FOREIGN TABLES };
{ANALYZE | ANALYSE} [ VERBOSE ]
@ -23,7 +23,7 @@
{ANALYZE | ANALYSE} VERIFY {FAST|COMPLETE}
table_name|index_name [CASCADE];
{ANALYZE | ANALYSE} VERIFY {FAST|COMPLETE}
table_name PARTITION (patrition_name) [CASCADE];
table_name PARTITION (partition_name) [CASCADE];
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -14,7 +14,7 @@
[ table_name [ ( column_name [, ...] ) ] ];
{ ANALYZE | ANALYSE } [ VERBOSE ]
[ table_name [ ( column_name [, ...] ) ] ]
PARTITION patrition_name;
PARTITION (partition_name);
{ ANALYZE | ANALYSE } [ VERBOSE ]
{ foreign_table_name | FOREIGN TABLES };
{ ANALYZE | ANALYSE } [ VERBOSE ]
@ -22,7 +22,7 @@
{ ANALYZE | ANALYSE } VERIFY { FAST | COMPLETE };
{ ANALYZE | ANALYSE } VERIFY { FAST | COMPLETE } table_name | index_name [ CASCADE ];
{ ANALYZE | ANALYSE } VERIFY { FAST | COMPLETE }
table_name PARTITION (patrition_name) [ CASCADE ];
table_name PARTITION (partition_name) [ CASCADE ];
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -0,0 +1,23 @@
<refentry id="SQL-CREATEEVENTTRIGGER">
<refmeta>
<refentrytitle>CREATE EVENT TRIGGER</refentrytitle>
<manvolnum>7</manvolnum>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>CREATE EVENT TRIGGER</refname>
<refpurpose>define a new event trigger</refpurpose>
</refnamediv>
<refsynopsisdiv>
<indexterm zone="sql-createeventtrigger">
<primary>CREATE EVENT TRIGGER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
CREATE EVENT TRIGGER name
ON event
[ WHEN filter_variable IN (filter_value [, ... ]) [ AND ... ] ]
EXECUTE PROCEDURE function name()
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -10,21 +10,24 @@
</refnamediv>
<refsynopsisdiv>
<synopsis>
CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [schema_name.] index_name ] ON table_name [ USING method ]
CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ IF NOT EXISTS ] [ [schema_name.] index_name ] ON table_name [ USING method ]
({ { column_name [ ( length ) ] | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] }[, ...] )
[ INCLUDE ( { column_name | ( expression ) }[, ...] ) ]
[ WITH ( {storage_parameter = value} [, ... ] ) ]
[ TABLESPACE tablespace_name ]
[ VISIBLE | INVISIBLE ]
[ WHERE predicate ];
CREATE [ UNIQUE ] INDEX [ [schema_name.] index_name ] ON table_name [ USING method ]
CREATE [ UNIQUE ] INDEX [ IF NOT EXISTS ] [ [schema_name.] index_name ] ON table_name [ USING method ]
( { { column_name | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS LAST ] } [, ...] )
[ LOCAL [ ( { PARTITION index_partition_name | SUBPARTITION index_subpartition_name [ TABLESPACE index_partition_tablespace ] } [, ...] ) ] | GLOBAL ]
[ INCLUDE ( { column_name | ( expression ) }[, ...] ) ]
[ WITH ( { storage_parameter = value } [, ...] ) ]
[ TABLESPACE tablespace_name ];
[ TABLESPACE tablespace_name ]
[ VISIBLE | INVISIBLE ];
NOTICE: 'SUBPARTITION index_subpartition_name' is only avaliable in CENTRALIZED mode!
NOTICE: 'column_name ( length )' is only avaliable in B-format database!
NOTICE: '[ VISIBLE | INVISIBLE ]' is only avaliable in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -12,6 +12,9 @@
<synopsis>
CREATE SCHEMA [ IF NOT EXISTS ] schema_name
[ AUTHORIZATION user_name ] [WITH BLOCKCHAIN] [ schema_element [ ... ] ];
CREATE SCHEMA schema_name
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ];
NOTICE: '[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -11,11 +11,13 @@
<refsynopsisdiv>
<synopsis>
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] table_name
( { column_name data_type [ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ]
( { column_name data_type [ CHARACTER SET | CHARSET charset ]
[ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ]
| table_constraint
| LIKE source_table [ like_option [...] ] }
[, ... ])
[ AUTO_INCREMENT [ = ] value ]
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ] [ [ DEFAULT ] COLLATE [ = ] collation ]
[ WITH ( {storage_parameter = value} [, ... ] ) ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ COMPRESS | NOCOMPRESS ]
@ -27,19 +29,20 @@ where column_constraint can be:
NULL |
CHECK ( expression ) |
DEFAULT default_expr |
GENERATED ALWAYS AS ( generation_expr ) STORED |
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
AUTO_INCREMENT |
UNIQUE index_parameters |
UNIQUE [KEY] index_parameters |
PRIMARY KEY index_parameters |
ENCRYPTED WITH ( COLUMN_ENCRYPTION_KEY = column_encryption_key, ENCRYPTION_TYPE = encryption_type_value ) |
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
[ ON DELETE action ] [ ON UPDATE action ] }
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
where table_constraint can be:
[ CONSTRAINT [ constraint_name ] ]
{ CHECK ( expression ) |
UNIQUE [ index_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters |
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] } [, ... ] ) index_parameters |
UNIQUE [ index_name ] [ USING method ] ( { { column_name | ( expression ) } [ ASC | DESC ] } [, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
PRIMARY KEY [ USING method ] ( { column_name [ ASC | DESC ] } [, ... ] ) index_parameters [ VISIBLE | INVISIBLE ] |
PARTIAL CLUSTER KEY ( column_name [, ... ] ) |
FOREIGN KEY [ index_name ] ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
[ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ] }
@ -66,11 +69,14 @@ where list_distribution_rules can be:
]
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '( expression )' in 'UNIQUE' clause of table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ VISIBLE | INVISIBLE ]' is only avaliable in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -12,38 +12,46 @@
<synopsis>
CREATE TABLE [ IF NOT EXISTS ] partition_table_name
( [
{ column_name data_type [ COLLATE collation ] [ column_constraint [ ... ] ]
{ column_name data_type [ CHARACTER SET | CHARSET charset ]
[ COLLATE collation ] [ column_constraint [ ... ] ]
| table_constraint
| LIKE source_table [ like_option [...] ] }
[, ... ]
] )
[ AUTO_INCREMENT [ = ] value ]
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ][ [ DEFAULT ] COLLATE [ = ] collation ]
[ WITH ( {storage_parameter = value} [, ... ] ) ]
[ COMPRESS | NOCOMPRESS ]
[ TABLESPACE tablespace_name ]
[ DISTRIBUTE BY { REPLICATION | { [ HASH ] ( column_name ) } } ]
NOTICE: DISTRIBUTE BY is only avaliable in DISTRIBUTED mode!
[ TO { GROUP groupname | NODE ( nodename [, ... ] ) } ]
PARTITION BY {
{VALUES (partition_key)} |
{RANGE (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] ( partition_less_than_item [, ... ] )} |
{RANGE (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] ( partition_start_end_item [, ... ] )} |
{LIST | HASH (partition_key) (PARTITION partition_name [ VALUES (list_values_clause) ] opt_table_space ) }
NOTICE: LIST/HASH partition is only avaliable in CENTRALIZED mode!
{RANGE [ COLUMNS ] (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] [ PARTITIONS integer ] ( partition_less_than_item [, ... ] )} |
{RANGE [ COLUMNS ] (partition_key) [ INTERVAL ('interval_expr') [ STORE IN ( tablespace_name [, ...] ) ] ] [ PARTITIONS integer ] ( partition_start_end_item [, ... ] )} |
{{{LIST [ COLUMNS ]} | HASH | KEY} (partition_key) [ PARTITIONS integer ] (PARTITION partition_name [ VALUES [ IN ] (list_values_clause) ] opt_table_space ) }
} [ { ENABLE | DISABLE } ROW MOVEMENT ];
NOTICE: [ COLUMNS ] is only available in B-format database!
NOTICE: [ PARTITIONS integer ] in RANGE/LIST partition is only available in B-format database!
NOTICE: [ IN ] is only available in B-format database!
NOTICE: KEY is only available in B-format database!
where column_constraint can be:
[ CONSTRAINT constraint_name ]
{ NOT NULL |
NULL |
CHECK ( expression ) |
DEFAULT default_expr |
GENERATED ALWAYS AS ( generation_expr ) STORED |
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
AUTO_INCREMENT |
UNIQUE index_parameters |
UNIQUE [KEY] index_parameters |
PRIMARY KEY index_parameters |
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
[ ON DELETE action ] [ ON UPDATE action ] }
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
where table_constraint can be:
[ CONSTRAINT [ constraint_name ] ]
{ CHECK ( expression ) |
@ -58,7 +66,8 @@ where index_parameters can be:
where like_option can be:
{ INCLUDING | EXCLUDING } { DEFAULTS | GENERATED | CONSTRAINTS | INDEXES | STORAGE | COMMENTS | RELOPTIONS | DISTRIBUTION | ALL }
where partition_less_than_item can be:
PARTITION partition_name VALUES LESS THAN ( { partition_value | MAXVALUE } ) [TABLESPACE tablespace_name]
PARTITION partition_name VALUES LESS THAN { ( { partition_value | MAXVALUE } [, ... ] ) | MAXVALUE } [TABLESPACE [=] tablespace_name]
NOTICE: MAXVALUE without parentheses is only available in B-format database!
where partition_start_end_item can be:
PARTITION partition_name {
{START(partition_value) END (partition_value) EVERY (interval_value)} |
@ -68,10 +77,12 @@ PARTITION partition_name {
} [TABLESPACE tablespace_name]
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -11,23 +11,30 @@
<refsynopsisdiv>
<synopsis>
CREATE TABLE [ IF NOT EXISTS ] subpartition_table_name
( { column_name data_type [ COLLATE collation ] [ column_constraint [ ... ] ]
( { column_name data_type [ CHARACTER SET | CHARSET charset ]
[ COLLATE collation ] [ column_constraint [ ... ] ]
| table_constraint
| LIKE source_table [ like_option [...] ] }
[, ... ]
)
[ AUTO_INCREMENT [ = ] value ]
[ [ DEFAULT ] CHARACTER SET | CHARSET [ = ] charset ][ [ DEFAULT ] COLLATE [ = ] collation ]
[ WITH ( {storage_parameter = value} [, ... ] ) ]
[ COMPRESS | NOCOMPRESS ]
[ TABLESPACE tablespace_name ]
PARTITION BY {RANGE | LIST | HASH} (partition_key) SUBPARTITION BY {RANGE | LIST | HASH} (subpartition_key)
PARTITION BY {RANGE [ COLUMNS ] | LIST [ COLUMNS ] | HASH | KEY} (partition_key) [ PARTITIONS integer ] SUBPARTITION BY {RANGE | LIST | HASH | KEY} (subpartition_key) [ SUBPARTITIONS integer ]
(
PARTITION partition_name1 [ VALUES LESS THAN (val1) | VALUES (val1[, ...]) ] [ TABLESPACE tablespace ]
PARTITION partition_name1 [ VALUES LESS THAN { (val1 | MAXVALUE) | MAXVALUE } | VALUES [ IN ] (val1[, ...]) ] [ TABLESPACE [=] tablespace ]
(
{ SUBPARTITION subpartition_name1 [ VALUES LESS THAN (val1_1) | VALUES (val1_1[, ...])] [ TABLESPACE tablespace ] } [, ...]
{ SUBPARTITION subpartition_name1 [ VALUES LESS THAN (val1_1) | VALUES (val1_1[, ...])] [ TABLESPACE [=] tablespace ] } [, ...]
)
[, ...]
) [ { ENABLE | DISABLE } ROW MOVEMENT ];
NOTICE: [ COLUMNS ] is only available in B-format database!
NOTICE: [ PARTITIONS integer ] in RANGE/LIST partition is only available in B-format database!
NOTICE: [ IN ] is only available in B-format database!
NOTICE: KEY is only available in B-format database!
NOTICE: MAXVALUE without parentheses is only available in B-format database!
where column_constraint can be:
[ CONSTRAINT constraint_name ]
@ -35,13 +42,14 @@ where column_constraint can be:
NULL |
CHECK ( expression ) |
DEFAULT default_expr |
GENERATED ALWAYS AS ( generation_expr ) STORED |
GENERATED ALWAYS AS ( generation_expr ) [STORED] |
AUTO_INCREMENT |
UNIQUE index_parameters |
UNIQUE [KEY] index_parameters |
PRIMARY KEY index_parameters |
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
[ ON DELETE action ] [ ON UPDATE action ] }
[ DEFERRABLE | NOT DEFERRABLE | INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
NOTICE: 'UNIQUE KEY' in table_constraint is only available in CENTRALIZED mode and B-format database!
where table_constraint can be:
[ CONSTRAINT [ constraint_name ] ]
{ CHECK ( expression ) |
@ -56,12 +64,14 @@ where index_parameters can be:
[ WITH ( {storage_parameter = value} [, ... ] ) ]
[ USING INDEX TABLESPACE tablespace_name ]
NOTICE: 'CREATE TABLE SUBPARTITION' is only avaliable in CENTRALIZED mode!
NOTICE: 'CREATE TABLE SUBPARTITION' is only available in CENTRALIZED mode!
NOTICE: '[ constraint_name ]' in table_constraint is optional in CENTRALIZED mode and B-format database, it is mandatory in other scenarios.
NOTICE: '[ index_name ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only avaliable in CENTRALIZED mode and B-format database!
NOTICE: '[ index_name ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ USING method ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ ASC | DESC ]' in table_constraint is only available in CENTRALIZED mode and B-format database!
NOTICE: 'AUTO_INCREMENT' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ CHARACTER SET | CHARSET ]' is only available in CENTRALIZED mode and B-format database!
NOTICE: '[ COLLATE [ = ] collation ]' is only available in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -0,0 +1,20 @@
<refentry id="SQL-DROPEVENTTRIGGER">
<refmeta>
<refentrytitle>DROP EVENT TRIGGER</refentrytitle>
<manvolnum>7</manvolnum>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>DROP EVENT TRIGGER</refname>
<refpurpose>remove an event trigger</refpurpose>
</refnamediv>
<refsynopsisdiv>
<indexterm zone="sql-dropeventtrigger">
<primary>DROP EVENT TRIGGER</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
DROP EVENT TRIGGER [ IF EXISTS ] name [ CASCADE | RESTRICT ]
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -13,6 +13,7 @@
[ WITH [ RECURSIVE ] with_query [, ...] ]
SELECT [/*+ plan_hint */] [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
{ * | {expression [ [ AS ] output_name ]} [, ...] }
[into_option]
[ FROM from_item [, ...] ]
[ WHERE condition ]
[ [ START WITH condition ] CONNECT BY condition [ ORDER SIBLINGS BY expression ] ]
@ -24,9 +25,27 @@ SELECT [/*+ plan_hint */] [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
[ LIMIT { [offset,] count | ALL } ]
[ OFFSET start [ ROW | ROWS ] ]
[ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
[into_option]
[ {FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | WAIT N | SKIP LOCKED]} [...] ]
[into_option]
TABLE { ONLY { (table_name) | table_name } | table_name [ * ]};
where into_option can be:
INTO var_name [, var_name] ...
| INTO OUTFILE 'file_name'
[CHARACTER SET charset_name]
export_options
| INTO DUMPFILE 'file_name'
where export_options can be:
[FIELDS
[TERMINATED BY 'string']
[[OPTIONALLY] ENCLOSED BY 'char']
[ESCAPED BY 'char' ]
]
[LINES
[STARTING BY 'string']
[TERMINATED BY 'string']
]
where from_item can be:
[ ONLY ] table_name [ * ] [ partition_clause ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ]
[ TABLESAMPLE sampling_method ( argument [, ...] ) [ REPEATABLE ( seed ) ] ]
@ -50,6 +69,7 @@ PARTITION { ( partition_name ) | FOR ( partition_value [, ...] ) }
SUBPARTITION { ( subpartition_name ) | FOR ( subpartition_value [, ...] )}
where nlssort_expression_clause can be:
NLSSORT ( column_name, ' NLS_SORT = { SCHINESE_PINYIN_M | generic_m_ci } ' )
NOTICE: [into_option] is only available in CENTRALIZED mode and B-format database.
NOTICE: '[ [ START WITH condition ] CONNECT BY condition [ ORDER SIBLINGS BY expression ] ]' is only avaliable in CENTRALIZED mode!
NOTICE: 'SUBPARTITION { ( subpartition_name ) | FOR ( subpartition_value [, ...] )}' is only avaliable in CENTRALIZED mode!
</synopsis>

View File

@ -24,6 +24,8 @@ SET [ SESSION | @@SESSION. | @@]
{ {config_parameter = { expr | DEFAULT }}};
SET @var_name := expr [, @var_name := expr] ...
SET @var_name = expr [, @var_name = expr] ...
NOTICE: '@var_name','{ GLOBAL | @@GLOBAL.}', '[ SESSION | @@SESSION. | @@]' are only avaiable in CENTRALIZED mode and B-format database, and enable_set_variable_b_format = on.
NOTICE: '@var_name' are only available in CENTRALIZED mode and B-format database.
NOTICE: '{ GLOBAL | @@GLOBAL.}' are only available in CENTRALIZED mode and B-format database.
NOTICE: '[ @@SESSION. | @@]' are only available in CENTRALIZED mode and B-format database.
</synopsis>
</refsynopsisdiv>

View File

@ -10,11 +10,12 @@
</refnamediv>
<refsynopsisdiv>
<synopsis>
{SET [ LOCAL ] TRANSACTION|SET SESSION CHARACTERISTICS AS TRANSACTION}
{SET [ LOCAL | SESSION | GLOBAL ] TRANSACTION|SET SESSION CHARACTERISTICS AS TRANSACTION}
{ ISOLATION LEVEL { READ COMMITTED | READ UNCOMMITTED }
| { READ WRITE | READ ONLY | SERIALIZABLE | REPEATABLE READ }
} [, ...]
SET TRANSACTION SNAPSHOT snapshot_id;
NOTICE: SET GLOBAL TRANSACTION is only available in CENTRALIZED mode and B-format database!
</synopsis>
</refsynopsisdiv>
</refentry>

View File

@ -310,7 +310,7 @@ docker_temp_server_start() {
# internal start of server in order to allow setup using gsql client
# does not listen on external TCP/IP and waits until start finishes
set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}"
set -- "$@" -c "listen_addresses='*'" -p "${PGPORT:-5432}"
PGUSER="${PGUSER:-$GS_USER}" \
gs_ctl -D "$PGDATA" \

31
docker/upgrade/README.md Normal file
View File

@ -0,0 +1,31 @@
容器化升级操作指南
前置条件:
旧版本容器集群状态正常
容器化升级操作步骤:
1. 准备升级工具、新版本容器和包
(1) 新版本容器镜像需载入到环境
(2) 将升级工具和新版本包放入升级路径
相关路径说明:
GAUSSDATA数据库数据目录默认为/var/lib/opengauss/data升级工具中可以通过-D指定
GAUSS_UPGRADE_BASE_PATH升级根路径默认为$GAUSSDATA/upgrade升级工具中可以通过-B指定
UPGRADE_NEW_PKG_PATH新包路径默认为$GAUSS_UPGRADE_BASE_PATH/pkg_new升级工具中可以通过-N指定
新版本包中必须包含version.cfg、upgrade_sql.tar.gz和upgrade_sql.sha256
2. 在**所有旧版本主备机容器**中执行前置升级动作
sh upgrade.sh -t upgrade_pre
3. 停掉所有旧版本库
4. 启动所有新版本库并在所有新版本主备机容器中执行upgrade_bin、upgrade_post和upgrade_commit动作
sh upgrade.sh -t upgrade_bin
sh upgrade.sh -t upgrade_post
sh upgrade.sh -t upgrade_commit
回退操作步骤:
case 1: 已切换到新二进制
sh upgrade.sh -t rollback_post (已执行upgrade_post动作)
sh upgrade.sh -t rollback_bin (已执行upgrade_bin动作)
退出新版本容器
case 2: 仅执行了upgrade_pre动作
sh upgrade.sh -t rollback_pre
**注意:**
如果升级路径和新包路径自行规划,则需要在新旧容器中做着两个路径的卷映射

61
docker/upgrade/upgrade.sh Normal file
View File

@ -0,0 +1,61 @@
#!/bin/bash
# Copyright (c) Huawei Technologies Co., Ltd. 2010-2022. All rights reserved.
# date: 2021-12-22
# version: 1.0
CURRENT_DIR=$(
cd $(dirname $0)
pwd
)
source ${CURRENT_DIR}/upgrade_common.sh
function main() {
parse_cmd_line $@
init_config
check_and_init
case "${action}" in
upgrade_pre)
upgrade_pre
exit 0
;;
upgrade_bin)
upgrade_bin
exit 0
;;
upgrade_post)
upgrade_post
exit 0
;;
rollback_pre)
rollback_pre
exit 0
;;
rollback_bin)
rollback_bin
exit 0
;;
rollback_post)
rollback_post
exit 0
;;
upgrade_commit)
upgrade_commit
exit 0
;;
query_start_mode)
query_start_mode
exit 0
;;
switch_over)
switch_over
exit 0
;;
*)
log "please input right parameter, the following command may help you"
log "sh upgrade_GAUSSV5.sh --help or sh upgrade_GAUSSV5.sh -h"
die "Must input parameter -t action" ${err_parameter}
;;
esac
}
main $@

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
#!/bin/bash
# Copyright (c) Huawei Technologies Co., Ltd. 2010-2022. All rights reserved.
# date: 2021-12-22
# version: 1.0
err_upgrade_pre=201
err_upgrade_bin=202
err_upgrade_post=203
err_rollback_pre=204
err_rollback_bin=205
err_rollback_post=206
err_check_init=207
err_parameter=208
err_upgrade_commit=209
err_version_same=210
err_no_need_commit=211
err_inner_sys=212
err_dn_role_null=213

@ -0,0 +1 @@
Subproject commit f2a09ee9e98b3c0ed1ec26da6f1c3ddacece41b1

@ -0,0 +1 @@
Subproject commit ba09836e0bb59243426a28b79c260570ec87e78e

@ -0,0 +1 @@
Subproject commit 5c3a84bd0c656ef7529a8fcd806e07f24560b415

@ -0,0 +1 @@
Subproject commit 22959853b32c2653c6dc663fb236329680847ed6

@ -0,0 +1 @@
Subproject commit 26e5d6310154258393807b95336c04b2eda991ce

1
openGauss-competition Submodule

@ -0,0 +1 @@
Subproject commit a8f2377a242dbdb6a8366738c85d365bef478477

1
openGauss-transaction Submodule

@ -0,0 +1 @@
Subproject commit d037643b5dfb030eb8b0da4ecb22b0bd6a51a8b1

1
openGauss-trigger Submodule

@ -0,0 +1 @@
Subproject commit f7a9a3b2e2c28a4f045a857debcaea372273826d

View File

@ -88,11 +88,19 @@ function check_install_env() {
fi
# check pid port and lock file
port_occupied=$(netstat -ntul | grep $port)
if [ X"$port_occupied" != X"" ]; then
error "Error: The port $port has been occupied, please use -p to set a new port."
exit 1
fi
portlist=($(netstat -nutl | grep $port))
i=3
while ((i < ${#portlist[*]}))
do
listen_addr=${portlist[((i))]}
p=${listen_addr##*:}
echo $p
if [ X"$p" == X"$port" ]; then
error "Error: The port $port has been occupied, please use -p to set a new port."
exit 1
fi
((i += 6))
done
local delete_slave_lock=""
local delete_master_lock=""

1
src/.gitignore vendored
View File

@ -86,7 +86,6 @@
/common/backend/utils/misc/guc-file.cpp
/common/backend/utils/pg_builtin_proc.h
/common/backend/utils/probes.h
/common/backend/utils/sort/qsort_tuple.cpp
/common/interfaces/ecpg/compatlib/exports.list
/common/interfaces/ecpg/ecpglib/exports.list
/common/interfaces/ecpg/ecpglib/path.cpp

View File

@ -193,7 +193,7 @@ endif()
if("${ENABLE_MULTIPLE_NODES}" STREQUAL "OFF")
install(DIRECTORY ${DCF_LIB_PATH} DESTINATION .)
endif()
if(${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
if(${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF AND NOT ${ENABLE_LITE_MODE} STREQUAL ON)
if(EXISTS ${DMS_LIB_PATH})
install(DIRECTORY ${DMS_LIB_PATH} DESTINATION .)
endif()

View File

@ -211,6 +211,7 @@ TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
with_openeuler_os = @with_openeuler_os@
with_openeuler_major = @with_openeuler_major@
#############################################################################
@ -728,6 +729,11 @@ endif
ifeq ($(with_openeuler_os), yes)
override CPPFLAGS := $(CPPFLAGS) -DWITH_OPENEULER_OS
endif
ifeq ($(with_openeuler_major), yes)
override CPPFLAGS := $(CPPFLAGS) -DOPENEULER_MAJOR
endif
CC = @CC@
GCC = @GCC@
C = gcc

View File

@ -69,3 +69,11 @@ endif
$(recurse)
$(recurse_always)
# psql and pg_dump need to make subtarget: libpq-ce, if these two targets make parallel, it
# may cause frontend_parser/gram.o: file not recognized: file truncated.
# I'm not sure why this happen, and since we use $(recurse) to make install and make all.
# I have no idea how to forbide psql and pg_dump to make parallel.
# So try to use NOTPARALLEL to avoid make parallel in this makefile. This will forbide all
# SUBDIRS make in parallel, which will decrease the compile speed...
.NOTPARALLEL:

View File

@ -58,10 +58,13 @@ audit_resource_policy|bool|0,0|NULL|NULL|
audit_rotation_interval|int|1,35791394|min|NULL|
audit_rotation_size|int|1024,1048576|kB|NULL|
audit_space_limit|int|1024,1073741824|kB|NULL|
audit_system_object|int|0,134217727|NULL|NULL|
audit_system_object|int|0,268435455|NULL|NULL|
audit_user_locked|int|0,1|NULL|NULL|
audit_user_violation|int|0,1|NULL|NULL|
audit_set_parameter|int|0,1|NULL|NULL|
no_audit_client|string|0,0|NULL|NULL|
full_audit_users|string|0,0|NULL|NULL|
audit_system_function_exec|int|0,1|NULL|NULL|
authentication_timeout|int|1,600|s|NULL|
autoanalyze|bool|0,0|NULL|NULL|
autovacuum|bool|0,0|NULL|Even if this parameter is set to off, when a transaction ID wraparound imminent, the database will automatically start the cleanup process automatically.|
@ -82,6 +85,7 @@ backslash_quote|enum|safe_encoding,on,off,true,false,yes,no,1,0|NULL|NULL|
backtrace_min_messages|enum|debug,debug5,debug4,debug3,debug2,debug1,log,info,notice,warning,error,fatal,panic|NULL|It will increase the cost of the system, when print the function stack information frequently. Therefore, when analyzing the problem, avoid setting the value of backtrace_min_messages for fatal following levels.|
bbox_dump_count|int|1,20|NULL|NULL|
bbox_dump_path|string|0,0|NULL|NULL|
b_format_behavior_compat_options|string|0,0|NULL|NULL|
behavior_compat_options|string|0,0|NULL|NULL|
plsql_compile_check_options|string|0,0|NULL|NULL|
bgwriter_delay|int|10,10000|ms|NULL|
@ -153,6 +157,7 @@ instr_unique_sql_count|int|0,2147483647|NULL|NULL|
track_stmt_session_slot|int|0,2147483647|NULL|NULL|
track_stmt_details_size|int64|0,100000000|NULL|NULL|
track_stmt_stat_level|string|0,0|NULL|NULL|
enable_availablezone|bool|0,0|NULL|NULL|
enable_instr_cpu_timer|bool|0,0|NULL|NULL|
enable_instr_rt_percentile|bool|0,0|NULL|NULL|
enable_instr_track_wait|bool|0,0|NULL|NULL|
@ -170,6 +175,7 @@ enable_codegen_print|bool|0,0|NULL|Enable dump for llvm function|
enable_delta_store|bool|0,0|NULL|NULL|
enable_default_cfunc_libpath|bool|0,0|NULL|NULL|
enable_defer_calculate_snapshot|bool|0,0|NULL|NULL|
enable_expr_fusion|bool|0,0|NULL|NULL|
codegen_cost_threshold|int|0,2147483647|NULL|Decided to use LLVM optimization or not|
codegen_strategy|enum|partial,pure|NULL|NULL|
enable_compress_spill|bool|0,0|NULL|NULL|
@ -194,6 +200,7 @@ enable_hdfs_predicate_pushdown|bool|0,0|NULL|NULL|
enable_hypo_index|bool|0,0|NULL|NULL|
enable_indexonlyscan|bool|0,0|NULL|NULL|
enable_indexscan|bool|0,0|NULL|NULL|
enable_inner_unique_opt|bool|0,0|NULL|NULL|
enable_kill_query|bool|0,0|NULL|NULL|
enable_material|bool|0,0|NULL|NULL|
enable_memory_limit|bool|0,0|NULL|NULL|
@ -438,7 +445,7 @@ ha_module_debug|bool|0,0|NULL|NULL|
require_ssl|bool|0,0|NULL|NULL|
resource_track_log|enum|summary,detail|NULL|NULL|
restart_after_crash|bool|0,0|NULL|NULL|
rewrite_rule|enum|lazyagg,magicset,partialpush,uniquecheck,disablerep,intargetlist,predpush,predpushforce,predpushnormal,disable_pullup_expr_sublink,none|NULL|NULL|
rewrite_rule|enum|lazyagg,magicset,partialpush,uniquecheck,disablerep,intargetlist,predpush,predpushforce,predpushnormal,disable_pullup_expr_sublink,enable_sublink_pullup_enhanced,none|NULL|NULL|
safe_data_path|string|0,0|NULL|NULL|
search_path|string|0,0|NULL|NULL|
session_replication_role|enum|origin,replica,local|NULL|When this parameter is set, any cached query plan will be lost before.|
@ -672,6 +679,7 @@ sql_beta_feature|enum|partition_fdw_on,partition_opfusion,index_cost_with_leaf_p
partition_iterator_elimination|bool|0,0|NULL|NULL|
enable_functional_dependency|bool|0,0|NULL|NULL|
enable_seqscan_fusion|bool|0,0|NULL|NULL|
enable_indexscan_optimization|bool|0,0|NULL|NULL|
max_logical_replication_workers|int|0,262143|NULL|Maximum number of logical replication worker processes.|
max_sync_workers_per_subscription|int|0,262143|NULL|Maximum number of table synchronization workers per subscription.|
walwriter_sleep_threshold|int64|1,50000|NULL|NULL|
@ -705,12 +713,14 @@ ss_enable_dms|bool|0,0|NULL|NULL|
ss_enable_catalog_centralized|bool|0,0|NULL|NULL|
ss_enable_reform|bool|0,0|NULL|NULL|
ss_enable_ssl|bool|0,0|NULL|NULL|
ss_enable_log_level|bool|0,0|NULL|NULL|
ss_enable_aio|bool|0,0|NULL|NULL|
ss_interconnect_channel_count|int|1,32|NULL|NULL|
ss_work_thread_count|int|16,128|NULL|NULL|
ss_recv_msg_pool_size|int|1024,1048576|kB|NULL|
ss_interconnect_type|string|0,0|NULL|NULL|
ss_log_level|int|0,887|NULL|NULL|
ss_log_backup_file_count|int|0,1024|NULL|NULL|
ss_log_max_file_size|int|1024,4194304|kB|NULL|
ss_instance_id|int|0,63|NULL|NULL|
ss_interconnect_url|string|0,0|NULL|NULL|
ss_rdma_work_config|string|0,0|NULL|NULL|
@ -723,6 +733,8 @@ ss_scrlock_worker_bind_core|string|0,0|NULL|NULL|
ss_scrlock_server_bind_core|string|0,0|NULL|NULL|
dolphin_server_port|int|1024,65535|NULL|NULL|
enable_dolphin_proto|bool|0,0|NULL|NULL|
enable_remote_excute|bool|0,0|NULL|NULL|
light_comm|bool|0,0|NULL|NULL|
[cmserver]
log_dir|string|0,0|NULL|NULL|
log_file_size|int|0,2047|MB|NULL|

View File

@ -1093,6 +1093,63 @@ int validate_node_instance_name(char* nodename, int type, char* instance_name)
return 0;
}
#ifndef ENABLE_MULTIPLE_NODES
/*
******************************************************************************
Function : gsguc_precheck_forbid_parameters
Description : Forbid reload/set/check GUC parameters in list for ALL node type
Input : nodename(indicates node name)
Output : none
Return : bool
******************************************************************************
*/
/* Forbid parameters for method "reload" with "all" nodes */
char *gsguc_forbid_list_reload[] = {
"listen_addresses",
NULL
};
bool gsguc_precheck_forbid_parameters(char *nodename)
{
/* If set pg_hba, just pass */
if (is_hba_conf) {
return true;
}
switch (ctl_command) {
case SET_CONF_COMMAND:
/* process checking parameters for SET mode */
break;
case RELOAD_CONF_COMMAND:
/* process checking parameters for RELOAD mode */
if (strncmp(nodename, "all", strlen("all")) != 0) {
break;
}
/* parameters not support '-N all' */
for (int i = 0; i < config_param_number && config_param[i] != NULL; i++) {
for (int j = 0; gsguc_forbid_list_reload[j] != NULL; j++) {
if (strcmp(config_param[i], gsguc_forbid_list_reload[j]) == 0) {
write_stderr(_("ERROR: \"%s\" can not \"%s\" with \"%s\" method.\n"),
gsguc_forbid_list_reload[j],
get_ctl_command_type(),
nodename);
return false;
}
}
}
break;
case CHECK_CONF_COMMAND:
/* process checking parameters for CHECK mode */
break;
default:
break;
}
return true;
}
#endif
/*
******************************************************************************
Function : validate_cluster_guc_options
@ -1371,10 +1428,16 @@ void process_cluster_guc_option(char* nodename, int type, char* instance_name, c
}
else
{
if (0 == strncmp(nodename, "all", sizeof("all")))
if (0 == strncmp(nodename, "all", strlen("all"))) {
#ifndef ENABLE_MULTIPLE_NODES
if (!gsguc_precheck_forbid_parameters(nodename)) {
exit(1);
}
#endif
do_all_nodes_instance(instance_name, indatadir);
else
} else {
do_remote_instance(nodename, instance_name, indatadir);
}
}
}

View File

@ -2634,6 +2634,8 @@ int main(int argc, char** argv)
char* pgdata_C = NULL;
char* nodename = NULL;
char* instance_name = NULL;
int nodeNum = 0;
int instanceNum = 0;
int nRet = 0;
errno_t rc = 0;
progname = PROG_NAME;
@ -2753,11 +2755,13 @@ int main(int argc, char** argv)
case 'N': {
GS_FREE(nodename);
nodename = xstrdup(optarg);
nodeNum++;
break;
}
case 'I': {
GS_FREE(instance_name);
instance_name = xstrdup(optarg);
instanceNum++;
break;
}
case 'M': {
@ -2909,6 +2913,11 @@ int main(int argc, char** argv)
return 0;
}
if (nodeNum > 1 || instanceNum > 1) {
write_stderr(_("ERROR: The number of -I or -N must less than 2.\n"));
exit(1);
}
if (false == allocate_memory_list()) {
write_stderr(_("ERROR: Failed to allocate memory to list.\n"));
exit(1);

View File

@ -584,6 +584,15 @@ function check_param_exists()
unique_params[$param_name]="true"
}
function isValidPort()
{
string=$1
if [[ ! $string =~ ^[0-9]+$ ]]; then
echo "ERROR: '"$string"' is not a valid port number"
exit 1
fi
}
function parse_cmd_params()
{
while [[ $# -gt 0 ]]; do
@ -603,12 +612,14 @@ function parse_cmd_params()
port=*)
check_param_exists "port"
cmd_param_port=$(get_value $1)
isValidPort $cmd_param_port
shift # past value
;;
-p)
check_param_exists "port"
shift
cmd_param_port=$1
isValidPort $cmd_param_port
shift
;;
user=*)

View File

@ -88,7 +88,7 @@ function logo()
echo " | | | | (_| | | | | ____) | | | | | | | |_| | | (_| | || (_) | | "
echo " |_| |_|\__,_|_| |_| |_____/|_|_| |_| |_|\__,_|_|\__,_|\__|___/|_| "
echo " "
echo " Version 3.1.0"
echo " Version 5.0.0"
echo "--------------------------------------------------------------------------"
}

View File

@ -3797,7 +3797,9 @@ static void usage(const char* prog_name)
#ifndef ENABLE_MULTIPLE_NODES
printf(_(" -c, --enable-dcf enable DCF mode\n"));
#endif
#ifndef ENABLE_LITE_MODE
printf(_(" --enable-dss enable shared storage mode\n"));
#endif
printf(_(" [-D, --pgdata=]DATADIR location for this database cluster\n"));
#ifdef ENABLE_MULTIPLE_NODES
printf(_(" --nodename=NODENAME name of openGauss node initialized\n"));
@ -3805,9 +3807,12 @@ static void usage(const char* prog_name)
#else
printf(_(" --nodename=NODENAME name of single node initialized\n"));
#endif
#ifndef ENABLE_LITE_MODE
printf(_(" --vgname=VGNAME name of dss volume group\n"));
printf(_(" --socketpath=SOCKETPATH\n"
" dss connect socket file path\n"));
printf(_(" --dms_url=URL message communication url between nodes\n"));
#endif
printf(_(" -E, --encoding=ENCODING set default encoding for new databases\n"));
printf(_(" --locale=LOCALE set default locale for new databases\n"));
printf(_(" --dbcompatibility=DBCOMPATIBILITY set default dbcompatibility for new database\n"));
@ -3891,6 +3896,7 @@ static bool is_file_exist(const char* path)
return isExist;
}
#ifndef ENABLE_LITE_MODE
static void parse_vgname_args(char* args)
{
vgname = xstrdup(args);
@ -3920,6 +3926,7 @@ static void parse_vgname_args(char* args)
exit(1);
}
}
#endif
int main(int argc, char* argv[])
{
@ -4198,7 +4205,7 @@ int main(int argc, char* argv[])
break;
case 8:
FREE_NOT_STATIC_ZERO_STRING(locale);
locale = "C";
locale = xstrdup("C");
break;
case 9:
FREE_NOT_STATIC_ZERO_STRING(pwfilename);
@ -4255,6 +4262,7 @@ int main(int argc, char* argv[])
}
g_bucket_len = atoi(optarg);
break;
#ifndef ENABLE_LITE_MODE
case 15:
FREE_NOT_STATIC_ZERO_STRING(vgname);
FREE_NOT_STATIC_ZERO_STRING(vgdata);
@ -4274,6 +4282,7 @@ int main(int argc, char* argv[])
check_input_spec_char(optarg);
ss_nodedatainfo = xstrdup(optarg);
break;
#endif
default:
/* getopt_long already emitted a complaint */
write_stderr(_("Try \"%s --help\" for more information.\n"), progname);

View File

@ -153,6 +153,17 @@ static void TablespaceValueCheck(TablespaceListCell* cell, const char* arg)
}
}
static void isPortNumber(const char *portarg)
{
int len = strlen(portarg);
for (int i = 0; i < len; i++) {
if (!(portarg[i] >= '0' && portarg[i] <= '9')) {
fprintf(stderr, _("invalid port number \"%s\"\n"), portarg);
exit(1);
}
}
}
/*
* Split argument into old_dir and new_dir and append to tablespace mapping
* list.
@ -268,6 +279,8 @@ static void GsTarUsage(void)
printf(_("\nOptions controlling the output:\n"));
printf(_(" -D, --destination=DIRECTORY untar files into directory\n"));
printf(_(" -F, --filename=FILENAME filename to be untar\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
}
static void tablespace_list_create()
@ -1141,8 +1154,6 @@ static void BaseBackup(void)
/* Error message already written in GetConnection() */
exit(1);
ClearAndFreePasswd();
/*
* Run IDENTIFY_SYSTEM so we can get the timeline
*/
@ -1322,6 +1333,7 @@ static void BaseBackup(void)
StartLogStreamer((const char *)xlogstart, timeline, sysidentifier);
}
ClearAndFreePasswd();
/* free sysidentifier after use */
PQfreemem(sysidentifier);
sysidentifier = NULL;
@ -1572,7 +1584,7 @@ static void GsTarHelp(int argc, char** argv) {
GsTarUsage();
exit(0);
} else if (strcmp(argv[1], "-V") == 0 || strcmp(argv[1], "--version") == 0) {
puts("gs_basebackup " DEF_GS_VERSION);
puts("gs_tar " DEF_GS_VERSION);
exit(0);
}
}
@ -1923,6 +1935,46 @@ static int GsBaseBackup(int argc, char** argv)
}
}
char optstring[] = "D:l:c:h:p:U:s:X:F:T:Z:t:wWvPxz";
/* check if a required_argument option has a void argument */
int i;
for (i = 0; i < argc; i++) {
char *optstr = argv[i];
int is_only_shortbar;
if (strlen(optstr) == 1) {
is_only_shortbar = optstr[0] == '-' ? 1 : 0;
} else {
is_only_shortbar = 0;
}
if (is_only_shortbar) {
fprintf(stderr, _("%s: The option '-' is not a valid option.\n"), progname);
exit(1);
}
char *oli = strchr(optstring, optstr[1]);
int is_shortopt_with_space;
if (oli != NULL && strlen(optstr) >= 1 && strlen(oli) >= 2) {
is_shortopt_with_space =
optstr[0] == '-' && oli != NULL && oli[1] == ':' && oli[2] != ':' && optstr[2] == '\0';
} else {
is_shortopt_with_space = 0;
}
if (is_shortopt_with_space) {
if (i == argc - 1) {
fprintf(stderr, _("%s: The option '-%c' need a parameter.\n"), progname, optstr[1]);
exit(1);
}
char *next_optstr = argv[i + 1];
char *next_oli = strchr(optstring, next_optstr[1]);
int is_arg_optionform = next_optstr[0] == '-' && next_oli != NULL;
if (is_arg_optionform) {
fprintf(stderr, _("%s: The option '-%c' need a parameter.\n"), progname, optstr[1]);
exit(1);
}
}
}
while ((c = getopt_long(argc, argv, "D:l:c:h:p:U:s:X:F:T:Z:t:wWvPxz", long_options, &option_index)) != -1) {
switch (c) {
case 'D': {
@ -2017,6 +2069,7 @@ static int GsBaseBackup(int argc, char** argv)
case 'p':
GS_FREE(dbport);
check_env_value_c(optarg);
isPortNumber(optarg);
dbport = inc_dbport(optarg);
break;
case 'U':
@ -2060,7 +2113,7 @@ static int GsBaseBackup(int argc, char** argv)
break;
}
}
/* If port is not specified by using -p, obtain the port through environment variables */
if (dbport == NULL) {
char *value = NULL;
@ -2071,6 +2124,7 @@ static int GsBaseBackup(int argc, char** argv)
} else {
fprintf(stderr, _("%s:The specified port is missing, it can be specified by -p parameter "
"or import environment variables PGPORT.\n"), progname);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
exit(1);
}
}

View File

@ -494,12 +494,12 @@ static int DoWALWrite(const char* wal_buf, int len, XLogRecPtr& block_pos, const
suspendHeartBeatTimer();
return DO_WAL_DATA_WRITE_ERROR;
}
/* Write was successful, advance our position */
bytes_written += bytes_to_write;
bytes_left -= bytes_to_write;
XLByteAdvance(block_pos, bytes_to_write);
xlogoff += bytes_to_write;
lastFlushPosition = block_pos;
/* Did we reach the end of a WAL segment? */
if (block_pos % XLogSegSize == 0) {
@ -586,14 +586,12 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const
* so that the master can remove WAL.
*/
reportFlushPosition = true;
ss_c = snprintf_s(slotcmd, MAXPGPATH, MAXPGPATH - 1, "SLOT \"%s\" ", replication_slot);
securec_check_ss_c(ss_c, "", "");
} else {
reportFlushPosition = false;
slotcmd[0] = 0;
}
reportFlushPosition = true;
if (sysidentifier != NULL) {
/* Validate system identifier and timeline hasn't changed */
res = PQexec(conn, "IDENTIFY_SYSTEM");

View File

@ -297,7 +297,7 @@ static void show_version(int alls)
if (alls) {
printf("OPENGAUSS_VERSION = ");
}
printf("openGauss 3.1.0\n");
printf("openGauss 5.0.0\n");
#endif
}

Some files were not shown because too many files have changed in this diff Show More