electric-sql / electric-sql/pglite

Validate that dbdata dir is of the correct PG version when starting.

Open
#12 1 comment 0 reactions 1 assignee Claimed by @tdrz View on GitHub
Dominant language
TypeScript
Stars
16k
Forks
442
Avg merge
20h 19m
Merged PRs (30d)
7

Description

I have a data directory that I initialized with `initdb`. When I try to run the example connecting to that data directory, the Promise returned by `db.query(...)` never resolves. Here's the code:

```ts
import { PGlite } from "@electric-sql/pglite";

const db = new PGlite("./pgdata");

await db.waitReady;

const result = await db.query("select 'Hello world' as message;");

console.log(result);

await db.close();
```

**EDIT**: I just realized that this is most likely because there is a difference in the version of postgres that created the dbs:

```
// created by installed initdb command on my machine
PostgreSQL 16.0 on aarch64-apple-darwin21.6.0, compiled by Apple clang version 14.0.0 (clang-1400.0.29.102), 64-bit

// created by pglite
PostgreSQL 15devel on aarch64-apple-darwin22.6.0, compiled by emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.25 (febd44b21ecaca86e2cb2a25ef3ed4a0a2076365), 32-bit
```

It would be nice to include an error for this type of thing. Are there plans for this to be resolved?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.