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

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

Open
nbbaier opened this issue Feb 24, 2024 · 1 comment
Open

Comments

@nbbaier
Copy link

nbbaier commented Feb 24, 2024

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:

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?

@samwillis
Copy link
Collaborator

Hey, yep, PGlite is using v15 and there is no compatibility between major pg versions data stores. We need to improve error handling in this situation.

thanks for the report.

@samwillis samwillis changed the title Query never resolves with pgdata directory created with initdb Validate that dbdata dir is of the correct PG version when starting. Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants