-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
cargo pgx schema
does CREATE OR REPLACE FUNCTION
and it probably shouldn't
#506
Comments
In addition to the potentially destructive behaviour using See https://www.postgresql.org/docs/14/extend-extensions.html#EXTEND-EXTENSIONS-SECURITY-SCRIPTS |
Note that the same security vulnerabilities arise with |
Considering the rather sternly worded recommendation to not use |
In general (for SQL functions, not C functions) it's used to update the body of an existing function. If you know that you We (the Promscale team at Timescale) have built mechanisms around the way that pgx generates functions in order for it to still be safe, so we would like to continue being able to use For additional context, what we do is the following:
I hope that helps somehow. |
I would say for extension upgrade scripts it's fine to use Since we only know how to generate an "initial creation" script, we should stick to |
After some thought, I think our practice of doing
CREATE OR REPLACE FUNCTION
is incorrect and potentially destructive to a database that might already have an existingfoo()
function.We should simply do
CREATE FUNCTION
, but perhaps we can have an attribute value#[pg_extern(or_replace)]
for when the developer thinks they know what they're doing.The text was updated successfully, but these errors were encountered: