Reset sequence value after file-based import
adding a new item on a collection, get the following error
There were validation errors for the following hidden fields: id: Value has to be unique
Version: Directus v9.0.0-rc.76
this seemed to have started after I updated some items with the new import from file method but I am not sure.
this seemed to have started after I updated some items with the new import from file method but I am not sure.
Ah that would make sense actually. Those creations will save the primary keys included in the CSV, but that won't reset the sequence used in the database.
What database are you using?
Postgres 13
for anyone looking how to reset this on the DB side
- run this query SELECT MAX(id) FROM your_table;
- SELECT nextval('your_table_id_seq'); mine was [your_table]_id_seq
- if the Valu from step 2 is not greater then the value form step1 then go to step 4
- run this query SELECT setval('your_table_id_seq',(SELECT GREATEST(MAX(your_id)+1,nextval('your_table_id_seq'))-1 FROM your_table)) "your_id" is the value from step 1
Only with Postgres 13?
Only with Postgres 13?
The above shared sql query is for postgres, yeah
Linear: ENG-294
Any ETA on this?
Any ETA on this?
Unfortunately, we can not provide estimates on features or fixes. As of now, the only way to get an accurate timeline or release date is to sponsor this task. We recognize that this may be an important feature/fix, but we are a small open-source organization with a lot to triage and complete. If you can't sponsor this ticket, then the next best thing is to increase its priority by giving it a 👍