@@ -1072,6 +1072,116 @@ SELECT * FROM cypher('cypher_merge', $$ MERGE p=(x:r)-[y:E]->(p)-[x]->(y) $$) AS
10721072ERROR: variable "p" is for a path
10731073LINE 1: ...M cypher('cypher_merge', $$ MERGE p=(x:r)-[y:E]->(p)-[x]->(y...
10741074 ^
1075+ -- issue 1219
1076+ SELECT * FROM create_graph('issue_1219');
1077+ NOTICE: graph "issue_1219" has been created
1078+ create_graph
1079+ --------------
1080+
1081+ (1 row)
1082+
1083+ SELECT * FROM cypher('issue_1219', $$ CREATE (x:Label1{arr:[1,2,3,4]}) RETURN x $$) as (a agtype);
1084+ a
1085+ -----------------------------------------------------------------------------------------
1086+ {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex
1087+ (1 row)
1088+
1089+ SELECT * FROM cypher('issue_1219', $$
1090+ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key1:2, key2:x.arr, key3:3}) RETURN y
1091+ $$) as (result agtype);
1092+ result
1093+ -----------------------------------------------------------------------------------------------------------------
1094+ {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex
1095+ (1 row)
1096+
1097+ SELECT * FROM cypher('issue_1219', $$
1098+ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key2:id(x)}) RETURN y
1099+ $$) as (result agtype);
1100+ result
1101+ ----------------------------------------------------------------------------------------------
1102+ {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex
1103+ (1 row)
1104+
1105+ SELECT * FROM cypher('issue_1219', $$ MATCH (x) RETURN x $$) as (a agtype);
1106+ a
1107+ -----------------------------------------------------------------------------------------------------------------
1108+ {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex
1109+ {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex
1110+ {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex
1111+ (3 rows)
1112+
1113+ -- these shouldn't create more
1114+ SELECT * FROM cypher('issue_1219', $$
1115+ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key1:2, key2:x.arr, key3:3}) RETURN y
1116+ $$) as (result agtype);
1117+ result
1118+ -----------------------------------------------------------------------------------------------------------------
1119+ {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex
1120+ (1 row)
1121+
1122+ SELECT * FROM cypher('issue_1219', $$
1123+ MATCH (x:Label1{arr:[1,2,3,4]}) MERGE (y:Label2{key2:id(x)}) RETURN y
1124+ $$) as (result agtype);
1125+ result
1126+ ----------------------------------------------------------------------------------------------
1127+ {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex
1128+ (1 row)
1129+
1130+ SELECT * FROM cypher('issue_1219', $$ MATCH (x) RETURN x $$) as (a agtype);
1131+ a
1132+ -----------------------------------------------------------------------------------------------------------------
1133+ {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex
1134+ {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex
1135+ {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex
1136+ (3 rows)
1137+
1138+ -- create a path
1139+ SELECT * FROM cypher('issue_1219', $$
1140+ CREATE (u:Label1{name: "John"})-[e:knows]->(v:Label1{name: "Jane"})
1141+ $$) as (result agtype);
1142+ result
1143+ --------
1144+ (0 rows)
1145+
1146+ SELECT * FROM cypher('issue_1219', $$
1147+ MATCH (u:Label1{name:"John"})-[e:knows]->(v:Label1{name: "Jane"})
1148+ MERGE (y:Label2{start_id:id(u), edge_id:id(e), end_id:id(v)}) RETURN y
1149+ $$) as (result agtype);
1150+ result
1151+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
1152+ {"id": 1125899906842627, "label": "Label2", "properties": {"end_id": 844424930131971, "edge_id": 1407374883553281, "start_id": 844424930131970}}::vertex
1153+ (1 row)
1154+
1155+ SELECT * FROM cypher('issue_1219', $$ MATCH (x) RETURN x $$) as (result agtype);
1156+ result
1157+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
1158+ {"id": 844424930131969, "label": "Label1", "properties": {"arr": [1, 2, 3, 4]}}::vertex
1159+ {"id": 844424930131970, "label": "Label1", "properties": {"name": "John"}}::vertex
1160+ {"id": 844424930131971, "label": "Label1", "properties": {"name": "Jane"}}::vertex
1161+ {"id": 1125899906842625, "label": "Label2", "properties": {"key1": 2, "key2": [1, 2, 3, 4], "key3": 3}}::vertex
1162+ {"id": 1125899906842626, "label": "Label2", "properties": {"key2": 844424930131969}}::vertex
1163+ {"id": 1125899906842627, "label": "Label2", "properties": {"end_id": 844424930131971, "edge_id": 1407374883553281, "start_id": 844424930131970}}::vertex
1164+ (6 rows)
1165+
1166+ SELECT * FROM cypher('issue_1219', $$ MATCH ()-[e]->() RETURN e $$) as (result agtype);
1167+ result
1168+ ----------------------------------------------------------------------------------------------------------------------------
1169+ {"id": 1407374883553281, "label": "knows", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {}}::edge
1170+ (1 row)
1171+
1172+ SELECT drop_graph('issue_1219', true);
1173+ NOTICE: drop cascades to 5 other objects
1174+ DETAIL: drop cascades to table issue_1219._ag_label_vertex
1175+ drop cascades to table issue_1219._ag_label_edge
1176+ drop cascades to table issue_1219."Label1"
1177+ drop cascades to table issue_1219."Label2"
1178+ drop cascades to table issue_1219.knows
1179+ NOTICE: graph "issue_1219" has been dropped
1180+ drop_graph
1181+ ------------
1182+
1183+ (1 row)
1184+
10751185--clean up
10761186SELECT * FROM cypher('cypher_merge', $$MATCH (n) DETACH DELETE n $$) AS (a agtype);
10771187 a
0 commit comments