| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- -- ============================================================
- -- 服务端 Bug 复现:单节点 Cypher Match nil pointer dereference
- -- ============================================================
- -- 环境要求: odbserver 运行在 127.0.0.1:11001, keyspace=oktest
- -- 运行方式: ./mql aaa/15cypher/bug_reproduce.mql
- -- 预期: 服务端 crash (runtime error: invalid memory address or nil pointer dereference)
- -- ============================================================
- -- 初始化:创建测试 class
- create class if not exists /test/aaa/test_graph (
- g_name varchar,
- g_type varchar,
- g_value int,
- indexes(g_name, g_type),
- keys(g_name)
- ) with nickname='test_graph'
- ;
- -- 插入测试数据
- insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('bug_node_a', 'type_a', 10)
- ;
- insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('bug_node_b', 'type_a', 20)
- ;
- /**
- sleep(1s)
- **/
- ;
- -- ============================================================
- -- Bug 1: 单节点 match + return 变量 → nil pointer
- -- ============================================================
- match (n:test_graph) return n
- /**
- onerror(continue)
- **/
- ;
- -- ============================================================
- -- Bug 2: 单节点 match + return n.* → nil pointer
- -- ============================================================
- match (n:test_graph) return n.*
- /**
- onerror(continue)
- **/
- ;
- -- ============================================================
- -- Bug 3: 单节点 match + return 字段列表 → nil pointer
- -- ============================================================
- match (n:test_graph) return n.g_name, n.g_type, n.g_value
- /**
- onerror(continue)
- **/
- ;
- -- ============================================================
- -- Bug 4: 多节点 match (逗号分隔, 无关系模式) → nil pointer
- -- ============================================================
- match (a:test_graph), (b:test_graph) where a.g_name='bug_node_a' and b.g_name='bug_node_b'
- create (a) -[:connect]-> (b)
- /**
- onerror(continue)
- **/
- ;
- -- ============================================================
- -- Bug 5: CypherCtrl 级别的 where + 子查询 in → 解析错误
- -- ============================================================
- match (a:test_graph) -[:connect]-> (b:test_graph) where a.g_name in (match (n:test_graph) return n.g_name) return a, b
- /**
- onerror(continue)
- **/
- ;
- -- ============================================================
- -- 以下是正常工作的 Cypher 查询(有明确关系路径)
- -- ============================================================
- -- 先建 edge type 和关系
- create edge type if not exists test.connect
- ;
- match (a:test_graph), (b:test_graph) where a.g_name='bug_node_a' and b.g_name='bug_node_b'
- create (a) -[:connect]-> (b)
- /**
- onerror(continue)
- **/
- ;
- -- 这个应该正常工作:有关系路径的 multi-node match
- match (a:test_graph) -[:connect]-> (b:test_graph) return a, b
- /**
- output()
- **/
- ;
- -- 清理
- delete from /test/aaa/test_graph with version
- /**
- onerror(continue,'not exist','not find','not found')
- **/
- ;
- drop class if exists /test/aaa/test_graph
- ;
|