Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data import from csv, auto-incremented big integer for ID #20550

Closed
semorur opened this issue Nov 27, 2023 · 5 comments · Fixed by #20867
Closed

data import from csv, auto-incremented big integer for ID #20550

semorur opened this issue Nov 27, 2023 · 5 comments · Fixed by #20867

Comments

@semorur
Copy link

semorur commented Nov 27, 2023

Describe the Bug

If I have a table with auto-incremented big integer for ID and when I import data with id numbers it doesn't restart sequence number. I tried to reproduce it with auto-increment integer, but it worked fine.

for example, when I have latest number 10, I import data with ID 11,12,13,14,15. When I add a new item there is error, because incremention remained at 10, not 15. So the next ID will be 11, but it's imposible because values have to be unique.

Also the same problem, when you allow editing ID and write in some numbers. for integer its is fine, for big integer it is not.

To Reproduce

  1. add new data model with ID auto-incremented big integer (make ID field visible, for comfort)
  2. add some fields
  3. add some data (3 entry, for example)
  4. export data to *.csv with all fields
  5. open *.csv and change ID fields (if you had 1,2,3 - make it 5,6,7)
  6. import *.csv
  7. add new data (you will see, that it gets ID=4)
  8. you will not be able to create next entry, because ID=5, but you already have ID=5

Directus Version

v.10.8.2

Hosting Strategy

Self-Hosted (Docker Image)

@rijkvanzanten
Copy link
Member

@semorur What database are you using?

@semorur
Copy link
Author

semorur commented Nov 27, 2023 via email

@rijkvanzanten
Copy link
Member

@jaads This feels very similar to #6321 with fix #19328 🤔 Any thoughts?

@semorur
Copy link
Author

semorur commented Nov 28, 2023 via email

@jaads jaads self-assigned this Dec 1, 2023
@jaads
Copy link
Member

jaads commented Dec 1, 2023

Interesting. I just checked it. Currently the sequence will be reset only for integer primary keys, not big integer:

pkField!.type === 'integer' &&

Assuming the SQL statement to reset stays the same, regardless of the type, this would be easy to fix/extend.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants