已关闭
[Bug]: ogsql 多行编辑 Up/Down/Backspace 重绘与历史召回异常 #300
wuchenlong创建于  7月27日关闭于  26 天前
wuchenlong
wuchenlong成员
7月27日 创建

测试类型

工具功能

测试版本

7.0.0-LTS

操作系统和硬件信息

openEuler 20.03 aarch64

测试环境

oGRAC双节点

被测功能

ogsql Readline 多行编辑 — Up/Down/Backspace 与历史召回、重绘

预置条件

oGRAC ONLINE;TTY ogsql / as sysdba;HISTORY ON。需求文档描述 ogsql_rollback_multiline_input、pendingHistory 多行快照。

操作步骤

# 15 边输边回车的 PL/SQL 块 + Up
SQL> Begin
  2 null;
  3 end;
  4 <Up>   -- 上一句也是同类块时,当前行重绘出重复块;Ctrl+L 清掉已输入

# 16 块注释空行 Backspace + Up
SQL> /*
  2 test comment
  3 <Backspace>  -- 行号变 29 等异常;再 Up 召回旧 SQL 且保留当前输入

# 18 字符串跨行 + Up
SQL> insert into test1(name,id) values ('
  2 test;
  3 '
  4 ,2);
  第 3 行 <Up>  -- 应识别引号内文本,不应召回上一条历史

# 19 超长 SQL Up 再 Down — 重绘错位(超长sql可见附件)
<a href="https://gitcode.com/user-attachments/files/8584069/913b067dd35b468f9780b3129c908735.txt" target="_blank">913b067dd35b468f9780b3129c908735.txt</a>

# 对照 15:同一 Begin 块用空格换行(无 continuation 行号)Up 正常

预期输出

15/16:Up 仅浏览历史或按多行回退语义撤回上一逻辑行,不重叠绘制两份块;
      Backspace 空 continuation 行应整体回退注释块,行号连续;Ctrl+L 不清未提交缓冲。
18:引号/字符串跨行时 Up 不穿越字符串召回历史。
19:超长语句 Up/Down 后屏幕与缓冲一致。

实际输出

15:按 Up 将上一 SQL(同为 Begin…end 块)重绘到当前行,出现嵌套重复;Ctrl+L 清屏且丢失已输入。
16:注释块第 3 空行 Backspace 后行号跳变(如 2→29);再 Up 保留当前多行输入同时插入历史 SQL。
18:第 3 行 Up 召回历史且未识别 'test;' 为字符串内容。
19:超长 SQL Up/Down 重绘异常(用户描述)。

日志信息

用户手工 #15/#16/#18/#19。多行渲染帧 pendingHistory 与字符串态机疑似缺陷。

提单组织

测试团队

likedislike
wuchenlongwuchenlong成员
7月27日 添加了label:bug
opengauss_bot
opengauss_bot成员
7月27日 评论:

This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.

likedislike
opengauss_botopengauss_bot成员
7月27日 将 TestManager 设为负责人
opengauss_botopengauss_bot成员
7月27日 添加了label:sig/StorageEngine
opengauss_bot
opengauss_bot成员
7月27日 评论:

Welcome To openGauss Community

Hey @wuchenlong , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: StorageEngine ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @CityYard, @libiao2024, @lijieac, @theothersideofsea, @wang_bowen, @weithu, @xiong_xjun, @yuanyazhi, @zhangzq131 .

likedislike
wuchenlongwuchenlong成员
7月27日 修改了issue 的描述
此处折叠了7条事件消息 查看更多
muyulinzhongmuyulinzhong成员
8月4日 移除了负责人 TestManager
leweiyang
leweiyang成员
8月21日 评论:

image.png

-- 建测试表(场景 18/19 需要)
DROP TABLE IF EXISTS test1 CASCADE;
CREATE TABLE test1 (id INT PRIMARY KEY, name VARCHAR(100));
INSERT INTO test1 VALUES (1, 'init');
COMMIT;

-- 确认历史记录开启
SET HISTORY ON;

-- 先执行几条历史语句,让历史队列有内容(场景 15/16/18 需要"上一条历史")
SELECT 1 FROM DUAL;
SELECT 2 FROM DUAL;
BEGIN NULL; END;
/

原问题输入后按UP会重绘导致出现重复块,现已修复,目前会整块调出上块历史,而不是在当前行多出上句历史;
SQL> Begin
2 null;
3 end;
4 <按 Up 键>
image.png

回退后行号正常
SQL> /*
2 test comment
3 <按 Backspace>
image.png

第三行按UP召回上行历史是正常行为,没有进行修改。
SQL> insert into test1(name,id) values ('
2 test;
3 '
4 ,2);
第 3 行 <按 Up 键>
image.png

超长块按Up后Down重绘正常
将附件SQL黏贴执行,按UP向上翻阅多次,再按DOWN回到最初
image.png

likedislike
leweiyangleweiyang成员
8月21日 关联了pull request:稳定 readline 粘贴、连续输入与多行编辑状态(#294、#297、#300)
leweiyangleweiyang成员
27 天前 issue状态由 待办的 改变为 待回归
wuchenlong
wuchenlong成员
26 天前 评论:

回归版本:oGRAC Release 7.0.0-RC3 18ce0a2 build 2026-08-26 09:48:01
回归环境:oGRAC 双节点(20.20.20.104 / 20.20.20.106),db=ONLINE,节点 20.20.20.104 执行
结论:通过(多行 PL/SQL 块、块注释 Backspace、字符串跨行 Up、超长 SQL Up/Down 重绘均正常)

回归步骤ogsql / as sysdba,Linux 真实 TTY,手工)

1) Begin / null; / end; 边输边回车,再 Up;Ctrl+L 清屏
2) /* 换行 test comment 再空行 Backspace
3) insert ... values (' 换行后再 Up
4) 超长 SQL Up 再 Down

实际输出
手工验证:

  1. Up 不叠两份块;Ctrl+L 不丢掉未提交输入
  2. Backspace 后行号连续,不再跳到 29
  3. 字符串跨行时 Up 不把历史 SQL 召进引号
  4. 超长 SQL Up/Down 后屏幕与缓冲一致、无残影
likedislike
wuchenlongwuchenlong成员
26 天前 issue状态由 待回归 改变为 已验收
wuchenlongwuchenlong成员
26 天前 关闭了 issue