BUG:插入选择边创建无效的TO引用

时间:2017-10-17 02:25:30

标签: orientdb

我怀疑这是一个严重的错误,并且引发了人们对OrientDB在各种DML操作期间如何管理图数据完整性的疑虑。

Edge如何拥有多个TO?

下面概述了一个简单的操作,即使用'插入选择'复制顶点。

初始状态

{
"result": [
    {
        "@type": "d",
        "@rid": "#-2:1",
        "@version": 0,
        "rid": "#133:46",
        "version": 1,
        "class": "RuleSet",
        "out_HasRule": [
            "#80:32"
        ],
        "@fieldTypes": "rid=x,out_HasRule=g"
    },
    {
        "@type": "d",
        "@rid": "#-2:2",
        "@version": 0,
        "rid": "#130:39",
        "version": 1,
        "class": "Rule",
        "in_HasRule": [
            "#80:32"
        ],
        "@fieldTypes": "rid=x,in_HasRule=g"
    }
],
"notification": "Query executed  in 0.213 sec. Returned 2 record(s)" }

如果执行以下操作,则会创建错误的边缘数据。 请注意,#80:32 是多个顶点的 IN

insert into Rule from select * from #130:39;


{
"result": [
    {
        "@type": "d",
        "@rid": "#-2:1",
        "@version": 0,
        "rid": "#133:46",
        "version": 1,
        "class": "RuleSet",
        "out_HasRule": [
            "#80:32"
        ],
        "@fieldTypes": "rid=x,out_HasRule=g"
    },
    {
        "@type": "d",
        "@rid": "#-2:2",
        "@version": 0,
        "rid": "#131:38",
        "version": 1,
        "class": "Rule",
        "in_HasRule": [
            "#80:32"
        ],
        "@fieldTypes": "rid=x,in_HasRule=g"
    },
    {
        "@type": "d",
        "@rid": "#-2:3",
        "@version": 0,
        "rid": "#130:39",
        "version": 1,
        "class": "Rule",
        "in_HasRule": [
            "#80:32"
        ],
        "@fieldTypes": "rid=x,in_HasRule=g"
    }
],
"notification": "Query executed  in 0.151 sec. Returned 3 record(s)"}

2 个答案:

答案 0 :(得分:0)

是的,INSERT / SELECT旨在复制文档,而不是顶点,因此它也会复制边缘指针。

我认为值得通过以下两种方式之一来修复它:

  • 删除边缘链接
  • 还复制边缘

请你在这里打开一个问题:https://github.com/orientechnologies/orientdb/issues 讨论会更容易

答案 1 :(得分:0)

谢谢Luigi!

这个问题是我们对任何数据库,数据完整性的期望的核心,所以我希望这个问题能够达到最高层。

此处已打开问题 - > https://github.com/orientechnologies/orientdb/issues/7826