bug_reproduce.mql 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. -- ============================================================
  2. -- 服务端 Bug 复现:单节点 Cypher Match nil pointer dereference
  3. -- ============================================================
  4. -- 环境要求: odbserver 运行在 127.0.0.1:11001, keyspace=oktest
  5. -- 运行方式: ./mql aaa/15cypher/bug_reproduce.mql
  6. -- 预期: 服务端 crash (runtime error: invalid memory address or nil pointer dereference)
  7. -- ============================================================
  8. -- 初始化:创建测试 class
  9. create class if not exists /test/aaa/test_graph (
  10. g_name varchar,
  11. g_type varchar,
  12. g_value int,
  13. indexes(g_name, g_type),
  14. keys(g_name)
  15. ) with nickname='test_graph'
  16. ;
  17. -- 插入测试数据
  18. insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('bug_node_a', 'type_a', 10)
  19. ;
  20. insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('bug_node_b', 'type_a', 20)
  21. ;
  22. /**
  23. sleep(1s)
  24. **/
  25. ;
  26. -- ============================================================
  27. -- Bug 1: 单节点 match + return 变量 → nil pointer
  28. -- ============================================================
  29. match (n:test_graph) return n
  30. /**
  31. onerror(continue)
  32. **/
  33. ;
  34. -- ============================================================
  35. -- Bug 2: 单节点 match + return n.* → nil pointer
  36. -- ============================================================
  37. match (n:test_graph) return n.*
  38. /**
  39. onerror(continue)
  40. **/
  41. ;
  42. -- ============================================================
  43. -- Bug 3: 单节点 match + return 字段列表 → nil pointer
  44. -- ============================================================
  45. match (n:test_graph) return n.g_name, n.g_type, n.g_value
  46. /**
  47. onerror(continue)
  48. **/
  49. ;
  50. -- ============================================================
  51. -- Bug 4: 多节点 match (逗号分隔, 无关系模式) → nil pointer
  52. -- ============================================================
  53. match (a:test_graph), (b:test_graph) where a.g_name='bug_node_a' and b.g_name='bug_node_b'
  54. create (a) -[:connect]-> (b)
  55. /**
  56. onerror(continue)
  57. **/
  58. ;
  59. -- ============================================================
  60. -- Bug 5: CypherCtrl 级别的 where + 子查询 in → 解析错误
  61. -- ============================================================
  62. match (a:test_graph) -[:connect]-> (b:test_graph) where a.g_name in (match (n:test_graph) return n.g_name) return a, b
  63. /**
  64. onerror(continue)
  65. **/
  66. ;
  67. -- ============================================================
  68. -- 以下是正常工作的 Cypher 查询(有明确关系路径)
  69. -- ============================================================
  70. -- 先建 edge type 和关系
  71. create edge type if not exists test.connect
  72. ;
  73. match (a:test_graph), (b:test_graph) where a.g_name='bug_node_a' and b.g_name='bug_node_b'
  74. create (a) -[:connect]-> (b)
  75. /**
  76. onerror(continue)
  77. **/
  78. ;
  79. -- 这个应该正常工作:有关系路径的 multi-node match
  80. match (a:test_graph) -[:connect]-> (b:test_graph) return a, b
  81. /**
  82. output()
  83. **/
  84. ;
  85. -- 清理
  86. delete from /test/aaa/test_graph with version
  87. /**
  88. onerror(continue,'not exist','not find','not found')
  89. **/
  90. ;
  91. drop class if exists /test/aaa/test_graph
  92. ;