Closed kamilogorek closed 6 months ago
After a quick investigation, this issue is caused by make sharedir
only handling src/backend install
which doesn't include pl
extensions. Those live inside a separate src/pl
directory.
Note that in order to start working on pl
compilation on osx, you need this patch applied locally https://github.com/postgres/postgres/commit/3aa021b29b0ecdafa518d225fa08b98d7bf5c84e
Hey @kamilogorek,
As you've spotted we currently don't build and bundle any of the standard extensions. But plpgsql is one we definitely want to support (python/perl/tlc are much lower priority and probably much more complex to make work).
We've not quite started work on adding support for extensions, it maybe that this is the best one to start with before moving onto pgvector and postgis.
There are some complexities around emscriptens handling of runtime loadable dylibs we need to test out. Essentially there are two routes:
Once we do a little more testing we will know more.
My current priority is parameterized queries, and a little benchmarking. Then it's onto extensions.
Build the extensions into the main WASM, we can then continue to do the dead code removal as it will be across everything in the bundle. But this again increases the size of the bundle for all users.
I think for something like plpgsql
that should be fine, as it's quite widely used, but for additional languages or other extensions, I agree that they should be opt-in.
Not sure if it's worth having 2 separate ways of including things into the core though, so maybe in the end, it's better to treat plpgsql
as a pluggable extensions as well.
I have pl/pgsql working in PR #48, there is a dev build linked from it's description. After trying to use emscriptens dynamic liking machinery and hitting a wall I swapped to statically linking the extension. Seems to work well.
We are planning to do a release early next week after a few final checks.
I expect we will find statically linking extensions (with the additional code changes needed) is the way to make this work for others too.
Can confirm that plpgsql
works as expected in the lastest build. Thanks!
postgres-wasm
has a full support forplpgsql
language extension, however for some reason it's not correctly loaded when instantiatingPGlite
.Code:
Output: