Amr-Shams commented on issue #1254:
URL: https://github.com/apache/age/issues/1254#issuecomment-1740051425

   I could think of a similar function that does the above. 
   I believe the sequence of actions taken in the preceding function refers to 
the following actions 
   
   ``` 
   CREATE OR REPLACE FUNCTION age_rename_label(
       graph_name text, 
       old_label text,
       new_label text)
   RETURNS void 
   AS $$
   BEGIN
      -- Update label name in age metadata tables
      UPDATE age_graph_labels 
      SET label = new_label 
      WHERE graph = graph_name AND label = old_label;
   
      -- Update label name in vertex tables
      EXECUTE format('ALTER TABLE %I.%I RENAME TO %I', graph_name, old_label, 
new_label);
      
      -- Update label name in edge tables
      EXECUTE format('ALTER TABLE %I.edge_of_%I RENAME TO edge_of_%I', 
graph_name, old_label, new_label);
   
      -- Rename related sequences
      EXECUTE format('ALTER TABLE %I.%I_id_seq RENAME TO %I_id_seq', 
graph_name, old_label, new_label);
      EXECUTE format('ALTER TABLE %I.edge_of_%I_id_seq RENAME TO 
edge_of_%I_id_seq', graph_name, old_label, new_label);
   END;
   $$ LANGUAGE plpgsql;
   ```


-- 
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