You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "waleedahmed0001 (via GitHub)" <gi...@apache.org> on 2023/05/20 09:40:49 UTC

[GitHub] [age] waleedahmed0001 commented on issue #939: Retaining vertices after deleting edges using constraints

waleedahmed0001 commented on issue #939:
URL: https://github.com/apache/age/issues/939#issuecomment-1555874624

   To delete an edge, use the match clause to find your edges, then add the variable to the DELETE.
   
   ```
   SELECT * 
   FROM cypher('graph_name', $$
   	MATCH (n {name: 'Andres'})-[r:KNOWS]->()
   	DELETE r
   $$) as (v agtype);
   ```
   
   The above query will just delete the relationship or edge while the vertex will remain there.
   
   But we use the detach delete command to delete the edges first associated with a vertex and then the vertex would be deleted.
   ```
   SELECT * 
   FROM cypher('graph_name', $$
   	MATCH (v:Useless)
   	 DETACH DELETE v
   $$) as (v agtype);
   ```
   
   So, there is no chance that vertex will be deleted directly by deleting the edges because vertex cannot be deleted if it has vertices attached with it using the delete command only.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org