Verify that MERGE does not introduce labels or properties to bound nodes
| 250 | |
| 251 | // Verify that MERGE does not introduce labels or properties to bound nodes |
| 252 | static AST_Validation _ValidateMergeNode |
| 253 | ( |
| 254 | const cypher_astnode_t *entity, // ast-node |
| 255 | rax *defined_aliases // bound variables |
| 256 | ) { |
| 257 | if(raxSize(defined_aliases) == 0) { |
| 258 | return AST_VALID; |
| 259 | } |
| 260 | |
| 261 | const cypher_astnode_t *identifier = cypher_ast_node_pattern_get_identifier(entity); |
| 262 | if(!identifier) { |
| 263 | return AST_VALID; |
| 264 | } |
| 265 | |
| 266 | const char *alias = cypher_ast_identifier_get_name(identifier); |
| 267 | // If the entity is unaliased or not previously bound, it cannot be redeclared |
| 268 | if(raxFind(defined_aliases, (unsigned char *)alias, strlen(alias)) == raxNotFound) { |
| 269 | return AST_VALID; |
| 270 | } |
| 271 | |
| 272 | // If the entity is already bound, the MERGE pattern should not introduce labels or properties |
| 273 | if(cypher_ast_node_pattern_nlabels(entity) || |
| 274 | cypher_ast_node_pattern_get_properties(entity)) { |
| 275 | ErrorCtx_SetError("The bound node '%s' can't be redeclared in a MERGE clause", alias); |
| 276 | return AST_INVALID; |
| 277 | } |
| 278 | |
| 279 | return AST_VALID; |
| 280 | } |
| 281 | |
| 282 | // Validate that the relation alias of an edge is not bound |
| 283 | static AST_Validation _ValidateCreateRelation |
no test coverage detected