pglite icon indicating copy to clipboard operation
pglite copied to clipboard

Add PGVector Support

Open e253 opened this issue 1 year ago • 3 comments

Hello PGlite maintainers,

I have pgvector linked statically same as plpgsql. I'm convinced despite this that dlopen cannot work in wasm. I gave the runtime linking approach considerable effort before capitulating back to trash-compacting all the objects in one step.

Some things you'll want to look at:

  1. I had to change pg_config.h --> PG_VERSION_NUM to 140000 for the pgvector build to finish without problems. This change is reverted after the build:ext step is finished.
  2. I haven't added tests for core pgvector functionality. I tested CREATE EXTENSION vector in a bun repl.
  3. I added more patches to the postgres.js file to fix problems with the postgres build on Ubuntu 22.04 WSL and debian:bookworm. I'm surprised this wasn't a problem before?
  4. I added the ability to set node exactly in the Makefile under packages/pglite becuase I had some permissions problems with what I think was the node binary under emsdk. Maybe that was misdiagnosed and that change can be reverted.

(Hopes to close #18 and help #19)

Corresponding PR in the PG submodule: https://github.com/electric-sql/postgres-wasm/pull/10.

e253 avatar May 31 '24 06:05 e253