Skip to content

Commit 525b442

Browse files
authored
Don't require a loaded function to have "compile lints" applied. (#327)
Loading an existing, compiled function should not require that it was previously compiled with the set of lints PL/Rust now uses for compilation. This prohibits newer versions of PL/Rust, which might have a new lint, from executing functions created with an older version without that lint. We do, however, continue to require the lints that are set in both the `$PLRUST_REQUIRED_LINTS` envar and the `plrust.required_lints` postgresql.conf GUC. This is a way for the administrator to flat out **require** that certain lints be applied to **every** function before it can be loaded/executed. PL/Rust's default stance, however, is that if it was good before, it's good now, even if new lints are applied going forward.
1 parent 30c21bd commit 525b442

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

plrust/src/gucs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ pub(crate) static PLRUST_ALLOWED_DEPENDENCIES: GucSetting<Option<&'static str>>
2727
static PLRUST_COMPILATION_TARGETS: GucSetting<Option<&'static str>> = GucSetting::new(None);
2828
pub(crate) static PLRUST_COMPILE_LINTS: GucSetting<Option<&'static str>> =
2929
GucSetting::new(Some(DEFAULT_LINTS));
30-
pub(crate) static PLRUST_REQUIRED_LINTS: GucSetting<Option<&'static str>> =
31-
GucSetting::new(Some(DEFAULT_LINTS));
30+
pub(crate) static PLRUST_REQUIRED_LINTS: GucSetting<Option<&'static str>> = GucSetting::new(None);
3231
pub(crate) static PLRUST_TRUSTED_PGRX_VERSION: GucSetting<Option<&'static str>> =
3332
GucSetting::new(Some(env!(
3433
"PLRUST_TRUSTED_PGRX_VERSION",

plrust/src/user_crate/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub(crate) fn required_lints() -> LintSet {
127127
// whatever might be configured in postgresql.conf
128128
let mut configured = PLRUST_REQUIRED_LINTS
129129
.get()
130-
.unwrap_or_else(|| PLRUST_COMPILE_LINTS.get().unwrap_or_default())
130+
.unwrap_or_default()
131131
.split(',')
132132
.filter_map(filter_map)
133133
.collect::<LintSet>();

0 commit comments

Comments
 (0)