You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "wangyong86 (via GitHub)" <gi...@apache.org> on 2026/01/21 05:34:27 UTC

[I] support overwrite with load_labels_from_file [age]

wangyong86 opened a new issue, #2312:
URL: https://github.com/apache/age/issues/2312

   My customer report:
   ```sql
   1205=# select load_labels_from_file('owg', 'Person', 'overwrite_load/file2.csv');
   ERROR:  Cannot insert duplicate vertex id: 957014890901079
   HINT:  Entry id 112589960769111 is already used
   ```
   
   They expect overwrite the existing vertex, which is like INSERT ... ON CONFLICT SET ...
   
   Although load into a temp table and using insert .. on conflict is viable, but customer can't accept it for complex operation.
   
   So, I'll try to implement it check existence first and update the conflict record like INSERT .. ON CONFLICT. Is it a resonable approach?


-- 
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.apache.org

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


Re: [I] support overwrite with load_labels_from_file [age]

Posted by "MuhammadTahaNaveed (via GitHub)" <gi...@apache.org>.
MuhammadTahaNaveed commented on issue #2312:
URL: https://github.com/apache/age/issues/2312#issuecomment-3779814392

   @wangyong86 The most natural approach given the existing bulk load flow is to delete the existing tuple when a conflict is detected and let the insertion continue uninterrupted. This preserves the batch insert performance that the csv loader is designed for, while adding the overwrite capability. The main tradeoff is that this can get costly if the index has bloat, since we need to deal with tuple visibility checks to find the actual conflicting tuple among potentially stale index entries. But for typical use cases (well maintained indexes), it should work well.
   
   Note that this can only be supported for `load_labels_from_file (vertices)` and specifically for id conflicts.


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


Re: [I] support overwrite with load_labels_from_file [age]

Posted by "wangyong86 (via GitHub)" <gi...@apache.org>.
wangyong86 commented on issue #2312:
URL: https://github.com/apache/age/issues/2312#issuecomment-3778347238

   I check the implementation of Insert .. on conflict. It's coupled with Executor tightly. A possbile approach is constructing plan and ExecUpdate when necessary. So, do you have better idea?


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


Re: [I] support overwrite with load_labels_from_file [age]

Posted by "wangyong86 (via GitHub)" <gi...@apache.org>.
wangyong86 commented on issue #2312:
URL: https://github.com/apache/age/issues/2312#issuecomment-3783084109

   For the below case and data
   ```sql
   1205=# select load_labels_from_file('owg', 'Personx', 'overwrite_load/file1.csv');
   ERROR:  Cannot insert duplicate vertex id: 957014890901079
   HINT:  Entry id 112589960769111 is already used
   1205=# \d+ "owg"."Personx";
                                                                                               Table "owg.Personx"
      Column   |  Type   | Collation | Nullable |                                                Default                                                | Storage  | Compression | Stats target | Description
   ------------+---------+-----------+----------+-------------------------------------------------------------------------------------------------------+----------+-------------+--------------+-------------
    id         | graphid |           | not null | _graphid(_label_id('owg'::name, 'Personx'::name)::integer, nextval('owg."Personx_id_seq"'::regclass)) | plain    |             |              |
    properties | agtype  |           | not null | agtype_build_map()                                                                                    | extended |             |              |
   Indexes:
       "Personx_pkey" PRIMARY KEY, btree (id)
   Inherits: owg._ag_label_vertex
   
   112589960769111,tom,25
   112589960769112,jonh,30
   112589960769113,michale,28
   ```
   load_labels_from_file check conflict using index of "Person_pkey",  but the real conflicted column is the sub-field of properties.
   
   So, it's a coincidence or a special design? It's reasonable to force a unique index on properties.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-unsubscribe@age.apache.org

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


Re: [I] support overwrite with load_labels_from_file [age]

Posted by "MuhammadTahaNaveed (via GitHub)" <gi...@apache.org>.
MuhammadTahaNaveed commented on issue #2312:
URL: https://github.com/apache/age/issues/2312#issuecomment-3778234297

   @wangyong86 The feature requested can be added to age csv loader, however, it might not be able to land in the upcoming release, since the release work has already started.
   
   I'll update when I have a PR ready for this request.


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


Re: [I] support overwrite with load_labels_from_file [age]

Posted by "MuhammadTahaNaveed (via GitHub)" <gi...@apache.org>.
MuhammadTahaNaveed commented on issue #2312:
URL: https://github.com/apache/age/issues/2312#issuecomment-3783735641

   @wangyong86 Entity ids encode label information and are generated at runtime from the label and entry_id (when the id_field_exists parameter is enabled, which it is by default). For a given label, the resulting ids are reproducible.


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