electric-sql / electric-sql/pglite
[BUG]: Unexpected auto-generated SERIAL column values when using IndexedDB filesystem
- Dominant language
- TypeScript
- Stars
- 16k
- Forks
- 442
- Avg merge
- 20h 19m
- Merged PRs (30d)
- 7
Description
**Describe the bug**
When using **PGlite with IndexedDB filesystem**, a `SERIAL` primary key increments by **33** on each insert instead of incrementing by **1**.
This does **not** happen when using the default (in-memory) storage.
**To Reproduce**
##### Code Sample
```vue
import { ref } from 'vue'
import { PGlite } from '@electric-sql/pglite'
import { live } from '@electric-sql/pglite/live'
const PGliteDB = await PGlite.create('idb://my-database', {
extensions: {
live,
},
})
// Default (Memory)
// const PGliteDB = await PGlite.create({
// extensions: {
// live,
// },
// })
const todo = ref()
await PGliteDB.exec(`
CREATE TABLE IF NOT EXISTS todo (
id SERIAL PRIMARY KEY,
task TEXT
);
INSERT INTO todo (task) VALUES ('task');
`)
todo.value = await PGliteDB.exec('SELECT * FROM todo;')
{{ todo }}
```
##### Repository
Minimal reproduction repository:
👉 [on branch (vue-pglite)](https://github.com/Us3r-gitHub/Playground/tree/vue-pglite)
---
**Logs / Screenshots**
##### Using IndexedDB
##### Using in-memory
### Comparison
| Storage type | Behavior |
| -------------------- | ------------------ |
| In-memory (default) | ✅ Increments by 1 |
| IndexedDB (`idb://`) | ❌ Increments by 33 |
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.