Skip to content

Commit 75ce99f

Browse files
authored
Add SET n:Label and REMOVE n:Label (#2281)
NOTE: This PR was built with AI tools and verified by a human. Implements Cypher SET and REMOVE operations for vertex labels in the unified vertex table architecture. This allows dynamic label management on vertices. SET n:Label * Only works on vertices with no label. * Auto-creates the label if it doesn't exist. * Errors with hint if vertex already has a label: "Multiple labels are not supported. Use REMOVE to clear the label first." REMOVE n:Label * Removes a vertex's specified label. * Properties are preserved * No-op if vertex already has no label Added regression tests. modified: regress/expected/cypher_remove.out modified: regress/expected/unified_vertex_table.out modified: regress/sql/unified_vertex_table.sql modified: src/backend/executor/cypher_set.c modified: src/backend/nodes/cypher_copyfuncs.c modified: src/backend/nodes/cypher_outfuncs.c modified: src/backend/nodes/cypher_readfuncs.c modified: src/backend/parser/cypher_clause.c modified: src/backend/parser/cypher_gram.y modified: src/include/nodes/cypher_nodes.h
1 parent 99dc094 commit 75ce99f

File tree

10 files changed

+1200
-174
lines changed

10 files changed

+1200
-174
lines changed

regress/expected/cypher_remove.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ ERROR: REMOVE cannot be the first clause in a Cypher query
463463
LINE 1: SELECT * FROM cypher('cypher_remove', $$REMOVE n.i$$) AS (a ...
464464
^
465465
SELECT * FROM cypher('cypher_remove', $$MATCH (n) REMOVE n.i = NULL$$) AS (a agtype);
466-
ERROR: REMOVE clause must be in the format: REMOVE variable.property_name
466+
ERROR: REMOVE clause must be in the format: REMOVE variable.property_name or REMOVE variable:Label
467467
LINE 1: SELECT * FROM cypher('cypher_remove', $$MATCH (n) REMOVE n.i...
468468
^
469469
SELECT * FROM cypher('cypher_remove', $$MATCH (n) REMOVE wrong_var.i$$) AS (a agtype);

0 commit comments

Comments
 (0)