Skip to content

Commit a82184b

Browse files
Drop stray Postgres 12 support in cargo-pgrx (pgcentralfoundation#2173)
Stop filtering `.control` fields Postgres 12 would not recognize. It is unnecessary in the Postgres 13 to Postgres 18 support window, and complicates the logic by requiring more parameters in `copy_file` and thus its callers. This simplification is also an incremental step towards addressing pgcentralfoundation#2152 (comment)
1 parent ba37a4e commit a82184b

1 file changed

Lines changed: 1 addition & 23 deletions

File tree

cargo-pgrx/src/command/install.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ pub(crate) fn install_extension(
174174
true,
175175
package_manifest_path,
176176
&mut output_tracking,
177-
pg_config,
178177
)?;
179178
}
180179

@@ -217,7 +216,6 @@ pub(crate) fn install_extension(
217216
false,
218217
package_manifest_path,
219218
&mut output_tracking,
220-
pg_config,
221219
)?;
222220
}
223221

@@ -246,7 +244,6 @@ fn copy_file(
246244
do_filter: bool,
247245
package_manifest_path: impl AsRef<Path>,
248246
output_tracking: &mut Vec<PathBuf>,
249-
pg_config: &PgConfig,
250247
) -> eyre::Result<()> {
251248
let Some(dest_dir) = dest.parent() else {
252249
// what fresh hell could ever cause such an error?
@@ -268,11 +265,7 @@ fn copy_file(
268265
// we want to filter the contents of the file we're to copy
269266
let input = fs::read_to_string(src)
270267
.wrap_err_with(|| format!("failed to read `{}`", src.display()))?;
271-
let mut input = filter_contents(package_manifest_path, input)?;
272-
273-
if src.display().to_string().ends_with(".control") {
274-
input = filter_out_fields_in_control(pg_config, input)?;
275-
}
268+
let input = filter_contents(package_manifest_path, input)?;
276269

277270
fs::write(&dest, input).wrap_err_with(|| {
278271
format!("failed writing `{}` to `{}`", src.display(), dest.display())
@@ -404,7 +397,6 @@ fn copy_sql_files(
404397
true,
405398
&package_manifest_path,
406399
output_tracking,
407-
pg_config,
408400
)?;
409401
}
410402
}
@@ -573,17 +565,3 @@ fn filter_contents(manifest_path: impl AsRef<Path>, mut input: String) -> eyre::
573565

574566
Ok(input)
575567
}
576-
577-
// remove fields in control for versions not supported
578-
// `trusted`` in only supported in version 13 and above
579-
fn filter_out_fields_in_control(pg_config: &PgConfig, mut input: String) -> eyre::Result<String> {
580-
if pg_config.major_version().unwrap() < 13 {
581-
input = input
582-
.lines()
583-
.filter(|line| !line.starts_with("trusted"))
584-
.collect::<Vec<_>>()
585-
.join("\n");
586-
}
587-
588-
Ok(input)
589-
}

0 commit comments

Comments
 (0)