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

Enable dynamically loaded postgres extensions #13

Open
wants to merge 3 commits into
base: wasm
Choose a base branch
from

Conversation

var77
Copy link

@var77 var77 commented Jul 12, 2024

  • To enable dynamic linking we need to compile postgres with MAIN_MODULE=1, but it will export all postgres symbols to JS, in emscripten there's a bug related to symbol collision issue with WASI symbols. Postgres has symbol proc_exit and symbol with the same name also exists in WASI runtime, so after exporting this symbol we are getting runtime error that proc_exit from wasi_snapshot_preview_1 is not found. I have renamed postgres symbol to pg_proc_exit to fix the issue until the fix from emscripten will be available. This may only break extensions which are using the proc_exit function from postgres.
  • Fixed function pointer casts issue by applying patch: https://github.com/postgres/postgres/commit/c35ba141de1fa04373671ba24c73eb0fe4862415.patch . Thus we can drop EMULATE_FUNCTION_POINTER_CASTS flag, so dlsym could work.
  • Comment out extension file check in dfmgr.c to allow passing any URL for extension wasm file as now the extension control file can contain full URL to wasm file under module_pathname

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

Successfully merging this pull request may close these issues.

1 participant