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

Derive symbols from postmaster not pgx-pg-sys #478

Merged
merged 6 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
351 changes: 14 additions & 337 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cargo-pgx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ syn = { version = "1.0.86", features = [ "extra-traits", "full", "fold", "parsin
unescape = "0.1.0"
fork = "0.1.18"
libloading = "0.7.3"
symbolic = "8.6.1"
object = "0.28"
eyre = "0.6.7"
color-eyre = "0.6.1"
tracing = "0.1.31"
Expand Down
33 changes: 12 additions & 21 deletions cargo-pgx/src/command/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ pub(crate) struct Install {
/// Build in test mode (for `cargo pgx test`)
#[clap(long)]
test: bool,
/// Don't regenerate the schema
#[clap(long)]
no_schema: bool,
/// The `pg_config` path (default is first in $PATH)
#[clap(long, short = 'c')]
pg_config: Option<String>,
Expand Down Expand Up @@ -57,7 +54,6 @@ impl CommandExecute for Install {
&pg_config,
self.release,
self.test,
self.no_schema,
None,
&features,
)
Expand All @@ -76,7 +72,6 @@ pub(crate) fn install_extension(
pg_config: &PgConfig,
is_release: bool,
is_test: bool,
no_schema: bool,
base_directory: Option<PathBuf>,
features: &clap_cargo::Features,
) -> eyre::Result<()> {
Expand Down Expand Up @@ -133,20 +128,16 @@ pub(crate) fn install_extension(
copy_file(&shlibpath, &dest, "shared library", false)?;
}

if !no_schema || !get_target_sql_file(&extdir, &base_directory)?.exists() {
copy_sql_files(
manifest,
pg_config,
is_release,
is_test,
features,
&extdir,
&base_directory,
build_command_messages,
)?;
} else {
println!("{} schema generation", " Skipping".bold().yellow());
}
copy_sql_files(
manifest,
pg_config,
is_release,
is_test,
features,
&extdir,
&base_directory,
true,
)?;

println!("{} installing {}", " Finished".bold().green(), extname);
Ok(())
Expand Down Expand Up @@ -256,7 +247,7 @@ fn copy_sql_files(
features: &clap_cargo::Features,
extdir: &PathBuf,
base_directory: &PathBuf,
build_command_output: Vec<cargo_metadata::Message>,
skip_build: bool,
) -> eyre::Result<()> {
let dest = get_target_sql_file(extdir, base_directory)?;
let (_, extname) = crate::command::get::find_control_file()?;
Expand All @@ -270,7 +261,7 @@ fn copy_sql_files(
Some(&dest),
Option::<String>::None,
None,
Some(build_command_output),
skip_build,
)?;

// now copy all the version upgrade files too
Expand Down
1 change: 0 additions & 1 deletion cargo-pgx/src/command/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ pub(crate) fn package_extension(
pg_config,
!is_debug,
is_test,
false,
Some(base_path),
features,
)
Expand Down
17 changes: 2 additions & 15 deletions cargo-pgx/src/command/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ pub(crate) struct Run {
/// Compile for release mode (default is debug)
#[clap(env = "PROFILE", long, short)]
release: bool,
/// Don't regenerate the schema
#[clap(long, short)]
no_schema: bool,
#[clap(flatten)]
features: clap_cargo::Features,
#[clap(from_global, parse(from_occurrences))]
Expand Down Expand Up @@ -73,14 +70,7 @@ impl CommandExecute for Run {
None => get_property("extname")?.ok_or(eyre!("could not determine extension name"))?,
};

run_psql(
&manifest,
pg_config,
&dbname,
self.release,
self.no_schema,
&features,
)
run_psql(&manifest, pg_config, &dbname, self.release, &features)
}
}

Expand All @@ -94,16 +84,13 @@ pub(crate) fn run_psql(
pg_config: &PgConfig,
dbname: &str,
is_release: bool,
no_schema: bool,
features: &clap_cargo::Features,
) -> eyre::Result<()> {
// stop postgres
stop_postgres(pg_config)?;

// install the extension
install_extension(
manifest, pg_config, is_release, false, no_schema, None, features,
)?;
install_extension(manifest, pg_config, is_release, false, None, features)?;

// restart postgres
start_postgres(pg_config)?;
Expand Down
Loading