Comments (2)
My best guess is that it is due to a transaction rollback or inserts with ON CONFLICT.
From PostgreSQL documentation:
To avoid blocking concurrent transactions that obtain numbers from the same sequence, the value obtained by nextval is not reclaimed for re-use if the calling transaction later aborts. This means that transaction aborts or database crashes can result in gaps in the sequence of assigned values. That can happen without a transaction abort, too. For example an INSERT with an ON CONFLICT clause will compute the to-be-inserted tuple, including doing any required nextval calls, before detecting any conflict that would cause it to follow the ON CONFLICT rule instead. Thus, PostgreSQL sequence objects cannot be used to obtain βgaplessβ sequences
If many rows are "updated" on conflict, then the computed sequence values will be lost. Unfortunately, I don't have a suggestion for resolving that issue.
from activerecord-import.
Ahh damn that makes sense - so mostly PostgreSQL behavior. Thanks for looking into this @jkowens ππΌ
from activerecord-import.
Related Issues (20)
- Import with synchronize docs issue
- How can I use import to do upsert in a model that has 2 unique indexes? HOT 1
- Proposal: `.import` should accept array-like objects
- Upcoming breakage with next Rails release HOT 8
- RuntimeError: Hstore value should be a hash HOT 3
- Inconsistent enum behavior
- why import do not return imported ids, when it called in sidekiq worker ? HOT 6
- Allow import of ignored columns - Suggested Feature HOT 1
- Empty ON CONFLICT targets HOT 1
- Question about performance: What are the order of things? HOT 5
- insert with existing association does not seem to work
- NonNull Violation and calling nextval() on sequence_name when primary key is uuid
- Failing imports are incrementing serial_sequence HOT 1
- `@schema_columns_hash` is not cleared by `.reset_column_information`. HOT 8
- alias_attribute causing "specified more than once" error upon import. HOT 6
- Support `trilogy` adapter HOT 7
- Using :on_duplicate_key_ignore option with conflict targets
- import! method is not raising when unique constraint violated while still inserting some records HOT 6
- Model#valid? Returning True For Invalid Records After Import HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from activerecord-import.