Comments (6)
Different databases (Azure PG/Ubuntu PG)
(I also added detail above)
from directus.
After looking at how the auto increment is set up in Postgres I have to tell you that this is indeed expected behavior and won't be changed. The primary key is drawn from a SEQUENCE
object and sequences are only guaranteed to be incrementing in nature but not gap-less.
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.1
As such I'll be closing this issue. If you need a strictly gapless ID for some reason (which to me seems like a weird requirement) you could resort to populating a different field after the fact in a flow (you would have to account for concurrent insert yourself then). And this is just something I can come up with on the top off my head, not a recommendation :D
Footnotes
from directus.
Since I'm not seeing this problem on my local instance with the SQLite driver, I've got a few clarifying questions:
- What DB vendor and version are you using?
- You're talking about two instances, are you running Directus as a cluster or are you seeing the same problems on two individual instances?
- Can you share your configuration (without sharing any secrets are API keys) to help us reproduce this issue.
from directus.
You're talking about two instances, are you running Directus as a cluster or are you seeing the same problems on two individual instances?
- There are two individual instances
What DB vendor and version are you using?
Can you share your configuration (without sharing any secrets are API keys) to help us reproduce this issue.
Instance 1
- Azure App service
- Docker image: directus:10.10.5
- Azure Database for PostgreSQL 16.2 - Flexible Server
- DB_SSL: true
- Collection: primary key (bigint), various inputs (text, multiple images, M20 relation, radio), boolean
Instance 2: air gapped network
- Ubuntu 22.04
- Postgres 16.2
- Docker image: directus:10.10.5
- DB_SSL: false
- Collection: primary key (bigint), various inputs (text, multiple images, M20 relation, radio), boolean
from directus.
And just to confirm, are you pointing both instances to the same DB instance or different ones as well?
from directus.
Additionally, the M2O related collection also has bigint primary key
from directus.
Related Issues (20)
- EXTENSIONS_AUTO_RELOAD feature does not work in Docker Container HOT 1
- Migration from 10.10.5 to 10.12.1 fails HOT 1
- Can't upload large files with S3 storage driver HOT 8
- Invalid foreign key on One-to-Many fields
- Many-to-Many (m2m) fields to not render translations properly without saving
- Include image extension when uploading images in preview URL & WYSIWYG content.
- Import of a JSON File with approx. 30.000 rows -> Failure Message "This file´s data structure does not match the collection." But after 1-2 hours datas are correctly imported.
- Updating Directus Version from 10.8 to 10.12 HOT 7
- Incorrect types infered for M2O/M2M relations in SDK for query filter
- Records with custom permission are not available in the API. HOT 2
- Numeric Fields for Labels Display - Configuration type problem
- Flows logs are not shown in flow sidebar HOT 1
- Flows - unable to use id/key in payload from Read Data operation HOT 1
- SDK type error on readItems when using 'datetime' literal HOT 3
- Make flow names & descriptions translatable
- The s3 file health-xxxxx generated by the health check was not cleared successfully HOT 3
- `items.read` doesn't seem to trigger every time HOT 1
- Some operations are missing when querying via `/operations` endpoint HOT 1
- Multiple API Calls Triggered on Typing in Any Field HOT 1
- Schema import issue: `A primary key should not be a foreign key`
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 directus.