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

Shared state #363

Open
fdietze opened this issue Jul 22, 2023 · 2 comments
Open

Shared state #363

fdietze opened this issue Jul 22, 2023 · 2 comments
Labels
enhancement New feature or request trust: sql-role

Comments

@fdietze
Copy link

fdietze commented Jul 22, 2023

Does plrust support or plan to support shared state between function calls, like Python does?

https://www.postgresql.org/docs/current/plpython-sharing.html

@workingjubilee
Copy link
Contributor

workingjubilee commented Jul 22, 2023

PL/Rust currently does not have an implementation of global shared state because it allows violating SQL role data access constraints, by someone calling plrust_a(), another person calling plrust_b(), and thereby exfiltrating data between those two functions across an SQL "role boundary". We would need to solve this problem to prevent SQL constraints from being violated, first, before we added this ability.

@thomcc
Copy link
Contributor

thomcc commented Jul 27, 2023

You can replicate SD from those docs by using thread_local or a static Mutex. But there's no equivalent to GD, for the reasons @workingjubilee mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request trust: sql-role
Projects
None yet
Development

No branches or pull requests

3 participants