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

Give directions on correct usage of pg_guard and similar #1406

Closed
workingjubilee opened this issue Nov 23, 2023 · 1 comment · Fixed by #1729
Closed

Give directions on correct usage of pg_guard and similar #1406

workingjubilee opened this issue Nov 23, 2023 · 1 comment · Fixed by #1729
Assignees
Labels
docs Improvements or additions to documentation ffi-safety

Comments

@workingjubilee
Copy link
Member

workingjubilee commented Nov 23, 2023

For a few fundamentally unsafe declarations, the ideal size should be as small as possible. There will be a similar function on MemCx. In the guide, we will need to explain code organization on a high level, and saying "really, try to make these as small as possible. pg_guard is for pgrx-pg-sys and certain callback-driven APIs, use pg_extern for anything you want to expose through an extension" is useful.

@workingjubilee workingjubilee added docs Improvements or additions to documentation ffi-safety labels Nov 23, 2023
@workingjubilee
Copy link
Member Author

workingjubilee commented Nov 23, 2023

We also could be up-front that the pg_extern annotations create an extremely thick shell function boundary to handle the Postgres Function Info V1 ABI, and that is why pg_guard functions have more restrictions! They don't get the protective wrappers and they aren't expected to handle the Postgres ABI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation ffi-safety
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants