-
Notifications
You must be signed in to change notification settings - Fork 219
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
PGlite Next - Based on Postgres 16.x #112
Conversation
This branch add support for building based on 16.x postgresql releases directly to add wasm support, emscripten dynamic loading for postgres extensions and ready for electric sql support via PGlite Typescript interface. --------- Co-authored-by: Sam Willis <[email protected]>
if this MR merged, if i want to using some other extension, for example pg-tde(encrypt the whole database), how can i do this? should i write some script and compile it to wasm? but i'am not good at cpp or c language. can you provide some docs on this ? @samwillis @pmp-p |
Hey @jueinin, Yes, we will provide docs and examples showing how to build custom extensions. |
…g bundlers to better minify
* WIP dump of data dir to a tar.gz * Dump and loading of a datadir to a tarball + tests * Swap to using File object for dump/load
Just a heads up, I'm hitting some issues running this on Next.js (webpack) with the error:
I'm still digging into this, but I believe this is related to the |
I managed to get past the above error by temporarily commenting out the Now running into a new
This happens during initialization for both Edit: Turns out the above issue was caused by loading a pre-0.2.0 database (via IndexedDB) into 0.2.0 PGlite. Deleting the old DB and starting fresh fixed the issue. I'll keep the above error in case there are plans for 0.2.0 to be backwards compatible. |
@gregnr postgres.so ( which was in fact libecpg.so ) is gone, only some symbols were needed in there so i re implemented them in static pglite main, it makes the bundle 520KiB smaller and extensions building easier so it was really important to do it before merge. freezing now, unless some bug is found or critical change required by upstream ofc ! |
@pmp-p Hi I'am wondering, can we add a password feature for pglite? given the right password, so that this pglite can be connected? |
md5 passwords can be handled and currently defaults to "password" but anyone could find it looking at the wasm or pglite source code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pmp-p
This is all awesome, we are very nearly there.
There is a failing test for dumping a tar of the datadir, I will fix that, it's a Node version < 20 issue 🤦♂️
On your side:
- Some of the files in /patches have a mix of spaces and tabs for indentation, we should match the style of the Postgres source (tabs) for these patch files.
- There is some commented out source code in some of the patches, can we remove it now?
- There is quite a bit of usage of
printf
for debug logging in the patch files and new pg_main/proto.c and interactive_one.c, can we remove any that’s no longer required, and any that’s useful to keep swap to the Postgreselog
macro? That way it’s configurable when it’s printed out with the debug level. - Are the library_fs.js and library_pgfs.js patches still required now that extensions are handled in the ts code?
- I now include tintar via npm in the ts build, can we remove it from /patches?
- Are you still using the files in /test/? CI tests are in /packages/pglite/tests, and we have examples in /packages/pglite/examples. If they are useful still could we move them into a dir that doesn’t look like a CI test folder?
- Could we tidy up the ci scripts:
- move cibuild.sh into /cibuild:
- Add comments to explain what the files are for/how they work
- Remove any commented out code that’s no longer required
- Remove any blocks that are not used
This PR changes for support building based on 16.x postgresql releases directly by patching in wasm support, emscripten dynamic loading for postgres extensions and ready for electric sql support via PGlite Typescript interface.
It also introduces CI with development builds on each PR, and support for extensions with pgvector being the first.
You can try this new build and the new REPL here: https://668ce81c27123c506c6a53a6--pglite-dev-demos.netlify.app/pglite/examples/repl
or, download the "PGlite" package from CI, unzip it, and manually install it in a project.
Each build now has a set of "interim build files", these are the output of the Emscripten build step. If you want to work on just the TypeScript side of PGlite, you can copy these files into
/packages/pglite/release/
and runpnpm build:js
to run the second step of the build.Some of the issues that will be resolved by this PR include:
SET TIME ZONE
throws error #62