@@ -1529,15 +1529,140 @@ SELECT * FROM cypher('issue_1691', $$MATCH (u) DELETE u $$) AS (a agtype);
1529
1529
---
1530
1530
(0 rows)
1531
1531
1532
+ --
1533
+ -- Issue 1709 - MERGE creates incomplete vertices after the first one
1534
+ -- This is actually an issue with MERGE not using the correct command id
1535
+ --
1536
+ SELECT * FROM create_graph('issue_1709');
1537
+ NOTICE: graph "issue_1709" has been created
1538
+ create_graph
1539
+ --------------
1540
+
1541
+ (1 row)
1542
+
1543
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u) RETURN u $$) AS (u agtype);
1544
+ u
1545
+ ---
1546
+ (0 rows)
1547
+
1548
+ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {first: 'ned', last: 'stark'}] AS map
1549
+ MERGE (v:PERSON {first: map.first})
1550
+ SET v=map
1551
+ RETURN v $$) AS (v agtype);
1552
+ v
1553
+ -----------------------------------------------------------------------------------------------------
1554
+ {"id": 844424930131969, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1555
+ {"id": 844424930131970, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex
1556
+ (2 rows)
1557
+
1558
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u) RETURN u $$) AS (u agtype);
1559
+ u
1560
+ -----------------------------------------------------------------------------------------------------
1561
+ {"id": 844424930131969, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1562
+ {"id": 844424930131970, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex
1563
+ (2 rows)
1564
+
1565
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u) DELETE u $$) AS (a agtype);
1566
+ a
1567
+ ---
1568
+ (0 rows)
1569
+
1570
+ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {first: 'ned', last: 'stark', middle: 'jim'}, {first: 'jane', last: 'doe'}, {first: 'ned', last: 'flanders'}, {first: 'wanda', last: 'cosmo'}] AS map
1571
+ MERGE (v:PERSON {first: map.first})
1572
+ SET v=map
1573
+ RETURN v $$) AS (v agtype);
1574
+ v
1575
+ ----------------------------------------------------------------------------------------------------------------------
1576
+ {"id": 844424930131971, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1577
+ {"id": 844424930131972, "label": "PERSON", "properties": {"last": "stark", "first": "ned", "middle": "jim"}}::vertex
1578
+ {"id": 844424930131973, "label": "PERSON", "properties": {"last": "doe", "first": "jane"}}::vertex
1579
+ {"id": 844424930131972, "label": "PERSON", "properties": {"last": "flanders", "first": "ned"}}::vertex
1580
+ {"id": 844424930131974, "label": "PERSON", "properties": {"last": "cosmo", "first": "wanda"}}::vertex
1581
+ (5 rows)
1582
+
1583
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u) RETURN u $$) AS (u agtype);
1584
+ u
1585
+ --------------------------------------------------------------------------------------------------------
1586
+ {"id": 844424930131971, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1587
+ {"id": 844424930131973, "label": "PERSON", "properties": {"last": "doe", "first": "jane"}}::vertex
1588
+ {"id": 844424930131972, "label": "PERSON", "properties": {"last": "flanders", "first": "ned"}}::vertex
1589
+ {"id": 844424930131974, "label": "PERSON", "properties": {"last": "cosmo", "first": "wanda"}}::vertex
1590
+ (4 rows)
1591
+
1592
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u) DELETE u $$) AS (a agtype);
1593
+ a
1594
+ ---
1595
+ (0 rows)
1596
+
1597
+ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {first: 'ned', last: 'stark'}] AS map
1598
+ MERGE (u: PERSON {last: map.last})-[e:KNOWS]->(v:PERSON {first: map.first})
1599
+ SET v=map
1600
+ RETURN u,e,v $$) AS (u agtype, e agtype, v agtype);
1601
+ u | e | v
1602
+ -------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------
1603
+ {"id": 844424930131975, "label": "PERSON", "properties": {"last": "snow"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131976, "start_id": 844424930131975, "properties": {}}::edge | {"id": 844424930131976, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1604
+ {"id": 844424930131977, "label": "PERSON", "properties": {"last": "stark"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131978, "start_id": 844424930131977, "properties": {}}::edge | {"id": 844424930131978, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex
1605
+ (2 rows)
1606
+
1607
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u)-[e]->(v) RETURN u,e,v $$) AS (u agtype, e agtype, v agtype);
1608
+ u | e | v
1609
+ -------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------
1610
+ {"id": 844424930131975, "label": "PERSON", "properties": {"last": "snow"}}::vertex | {"id": 1125899906842625, "label": "KNOWS", "end_id": 844424930131976, "start_id": 844424930131975, "properties": {}}::edge | {"id": 844424930131976, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1611
+ {"id": 844424930131977, "label": "PERSON", "properties": {"last": "stark"}}::vertex | {"id": 1125899906842626, "label": "KNOWS", "end_id": 844424930131978, "start_id": 844424930131977, "properties": {}}::edge | {"id": 844424930131978, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex
1612
+ (2 rows)
1613
+
1614
+ SELECT * FROM cypher('issue_1709', $$ MATCH ()-[e]->() DELETE e $$) AS (a agtype);
1615
+ a
1616
+ ---
1617
+ (0 rows)
1618
+
1619
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u) DELETE u $$) AS (a agtype);
1620
+ a
1621
+ ---
1622
+ (0 rows)
1623
+
1624
+ SELECT * FROM cypher('issue_1709', $$ UNWIND [{first: 'jon', last: 'snow'}, {first: 'ned', last: 'stark'}] AS map
1625
+ MERGE (u: PERSON {last: map.last})-[e:KNOWS]->(v:PERSON {first: map.first})
1626
+ SET u=map SET v=map
1627
+ RETURN u,e,v $$) AS (u agtype, e agtype, v agtype);
1628
+ u | e | v
1629
+ -----------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------
1630
+ {"id": 844424930131979, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 844424930131980, "start_id": 844424930131979, "properties": {}}::edge | {"id": 844424930131980, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1631
+ {"id": 844424930131981, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 844424930131982, "start_id": 844424930131981, "properties": {}}::edge | {"id": 844424930131982, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex
1632
+ (2 rows)
1633
+
1634
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u)-[e]->(v) RETURN u,e,v $$) AS (u agtype, e agtype, v agtype);
1635
+ u | e | v
1636
+ -----------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------
1637
+ {"id": 844424930131979, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex | {"id": 1125899906842627, "label": "KNOWS", "end_id": 844424930131980, "start_id": 844424930131979, "properties": {}}::edge | {"id": 844424930131980, "label": "PERSON", "properties": {"last": "snow", "first": "jon"}}::vertex
1638
+ {"id": 844424930131981, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex | {"id": 1125899906842628, "label": "KNOWS", "end_id": 844424930131982, "start_id": 844424930131981, "properties": {}}::edge | {"id": 844424930131982, "label": "PERSON", "properties": {"last": "stark", "first": "ned"}}::vertex
1639
+ (2 rows)
1640
+
1641
+ SELECT * FROM cypher('issue_1709', $$ MATCH ()-[e]->() DELETE e $$) AS (a agtype);
1642
+ a
1643
+ ---
1644
+ (0 rows)
1645
+
1646
+ -- clean up
1647
+ SELECT * FROM cypher('issue_1709', $$ MATCH (u) DELETE u $$) AS (a agtype);
1648
+ a
1649
+ ---
1650
+ (0 rows)
1651
+
1532
1652
--
1533
1653
-- clean up graphs
1534
1654
--
1535
- SELECT * FROM cypher('cypher_merge', $$MATCH (n) DETACH DELETE n $$) AS (a agtype);
1655
+ SELECT * FROM cypher('cypher_merge', $$ MATCH (n) DETACH DELETE n $$) AS (a agtype);
1536
1656
a
1537
1657
---
1538
1658
(0 rows)
1539
1659
1540
- SELECT * FROM cypher('issue_1630', $$MATCH (n) DETACH DELETE n $$) AS (a agtype);
1660
+ SELECT * FROM cypher('issue_1630', $$ MATCH (n) DETACH DELETE n $$) AS (a agtype);
1661
+ a
1662
+ ---
1663
+ (0 rows)
1664
+
1665
+ SELECT * FROM cypher('issue_1709', $$ MATCH (n) DETACH DELETE n $$) AS (a agtype);
1541
1666
a
1542
1667
---
1543
1668
(0 rows)
@@ -1595,6 +1720,18 @@ NOTICE: graph "issue_1691" has been dropped
1595
1720
1596
1721
(1 row)
1597
1722
1723
+ SELECT drop_graph('issue_1709', true);
1724
+ NOTICE: drop cascades to 4 other objects
1725
+ DETAIL: drop cascades to table issue_1709._ag_label_vertex
1726
+ drop cascades to table issue_1709._ag_label_edge
1727
+ drop cascades to table issue_1709."PERSON"
1728
+ drop cascades to table issue_1709."KNOWS"
1729
+ NOTICE: graph "issue_1709" has been dropped
1730
+ drop_graph
1731
+ ------------
1732
+
1733
+ (1 row)
1734
+
1598
1735
--
1599
1736
-- End
1600
1737
--
0 commit comments