avowkind commented on issue #365:
URL: https://github.com/apache/age/issues/365#issuecomment-2048614693

   This query
   
   SELECT * FROM cypher('fishpond', $$
   MATCH ()-[edge:featureOfInterest]->()
   where id(edge) = 3377699720847780
   RETURN edge ORDER BY id(edge) $$) as (edge agtype);
   
   Returns null
   But this
   
   SELECT *
   FROM fishpond._ag_label_edge e
   WHERE id::text = '3377699720847780’;
   
   Return s
   "3377699720847780""2533274790715812""2251799813685250""{}"
   
   Where vertex 2533274790715812 does not exist.
   
   So the above delete also doesn’t work.
   
   Here is SQL to list dangling edges
   SELECT e.*
   FROM fishpond._ag_label_edge e
   LEFT JOIN fishpond._ag_label_vertex v ON e.start_id = v.id
   WHERE v.id IS NULL;
   
   Let me know if you think this is right. - I get one result - the known issue.
   
   So I then run
   DELETE FROM fishpond._ag_label_edge e
   WHERE id::text = '3377699720847780’;
   
   Removing the line from the edge table.
   
   And this fixes everything. The VLE search now runs ok.
   
   So to sum up.
   
   We have a dangling edge in ._ag_label_edge where the start_id does not exist 
or was somehow removed from the vertices table.
   
   The check for dangling edges is
   
   Here is SQL to list dangling edges
   SELECT e.*
   FROM fishpond._ag_label_edge e
   LEFT JOIN fishpond._ag_label_vertex v ON e.start_id = v.id
   WHERE v.id IS NULL;
   
   And then you can delete an edge using
   DELETE FROM fishpond._ag_label_edge e
   WHERE id::text = '{id}'
   
   I had to cast the id from a graphID.
   
   The underlying question is whether a query of the form
   MATCH. x pattern
   DELETE x
   
   Without the DETACH leaves dangling edges by design.
   
   Thanks Andrew
   
   > On 11 Apr 2024, at 11:36 AM, John Gemignani ***@***.***> wrote:
   >
   > Only the end vertex for the edge exists.
   >
   > fishpond=# SELECT * FROM cypher('fishpond', $$ MATCH (u) WHERE id(u) = 
2533274790715812 RETURN u $$) as (u agtype);
   >  u
   > ---
   > (0 rows)
   >
   > fishpond=# SELECT * FROM cypher('fishpond', $$ MATCH (u) WHERE id(u) = 
1407374883553780 RETURN u $$) as (u agtype);
   >                                                                            
                                            u
   >
   > 
------------------------------------------------------------------------------------------------------------------------------------
   > 
-----------------------------------------------------------------------------------------------------------
   >  {"id": 1407374883553780, "label": "Feature", "properties": {"id": 
"pfr:nelson:tank:C09", "name": "C09", "relations": [{"id": "pfr:n
   > elson:tank_group:C", "relation": "partOf"}], "description": "C09", 
"featureGroup": "pfr:fg:tank"}}::vertex
   > (1 row)
   >
   > fishpond=#
   >
   > —
   > Reply to this email directly, [view it on 
GitHub](https://github.com/apache/age/issues/365#issuecomment-2048602594), or 
[unsubscribe](https://github.com/notifications/unsubscribe-auth/AAMFYFMAUKHHYSA7LOBBMFLY4XEGHAVCNFSM6AAAAAASIWFLLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGYYDENJZGQ).
   > You are receiving this because you were mentioned.Message ID: ***@***.***>


-- 
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-unsubscr...@age.apache.org

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

Reply via email to