diff --git a/cargo-pgx/README.md b/cargo-pgx/README.md index 65cf9471da..e4e98d6159 100644 --- a/cargo-pgx/README.md +++ b/cargo-pgx/README.md @@ -560,10 +560,11 @@ The flags are typically set by a linker script: # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -574,7 +575,6 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then else gcc -Wl,-undefined,dynamic_lookup $@ fi - ``` Which would be configured in `.cargo/config` for supported targets: diff --git a/cargo-pgx/src/commands/install.rs b/cargo-pgx/src/commands/install.rs index 90bbd24d6b..41ec926c4b 100644 --- a/cargo-pgx/src/commands/install.rs +++ b/cargo-pgx/src/commands/install.rs @@ -53,7 +53,7 @@ pub(crate) fn install_extension( additional_features, &extdir, &base_directory, - ); + )?; println!("{} installing {}", " Finished".bold().green(), extname); Ok(()) @@ -130,7 +130,7 @@ fn copy_sql_files( additional_features: Vec<&str>, extdir: &PathBuf, base_directory: &PathBuf, -) { +) -> Result<(), std::io::Error> { let mut dest = base_directory.clone(); dest.push(extdir); @@ -147,8 +147,7 @@ fn copy_sql_files( None, false, true, - ) - .unwrap(); + )?; let written = std::fs::read_to_string(&dest).unwrap(); let written = filter_contents(written); std::fs::write(&dest, written).unwrap(); @@ -169,6 +168,7 @@ fn copy_sql_files( } } } + Ok(()) } pub(crate) fn find_library_file(extname: &str, is_release: bool) -> PathBuf { diff --git a/cargo-pgx/src/commands/schema.rs b/cargo-pgx/src/commands/schema.rs index 7968554b29..e823e47a8a 100644 --- a/cargo-pgx/src/commands/schema.rs +++ b/cargo-pgx/src/commands/schema.rs @@ -140,7 +140,7 @@ pub(crate) fn generate_schema( println!("{} SQL entities", " Discovering".bold().green(),); let dsym_path = sql_gen_path.resolve_dsym(); let buffer = ByteView::open(dsym_path.as_deref().unwrap_or(&sql_gen_path))?; - let archive = Archive::parse(&buffer).unwrap(); + let archive = Archive::parse(&buffer).expect("Could not parse archive"); let mut fns_to_call = Vec::new(); for object in archive.objects() { diff --git a/cargo-pgx/src/templates/pgx-linker-script.sh b/cargo-pgx/src/templates/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100644 --- a/cargo-pgx/src/templates/pgx-linker-script.sh +++ b/cargo-pgx/src/templates/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/aggregate/.cargo/pgx-linker-script.sh b/pgx-examples/aggregate/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/aggregate/.cargo/pgx-linker-script.sh +++ b/pgx-examples/aggregate/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/arrays/.cargo/pgx-linker-script.sh b/pgx-examples/arrays/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/arrays/.cargo/pgx-linker-script.sh +++ b/pgx-examples/arrays/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/bytea/.cargo/pgx-linker-script.sh b/pgx-examples/bytea/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/bytea/.cargo/pgx-linker-script.sh +++ b/pgx-examples/bytea/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/custom_sql/.cargo/pgx-linker-script.sh b/pgx-examples/custom_sql/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/custom_sql/.cargo/pgx-linker-script.sh +++ b/pgx-examples/custom_sql/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/custom_types/.cargo/pgx-linker-script.sh b/pgx-examples/custom_types/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/custom_types/.cargo/pgx-linker-script.sh +++ b/pgx-examples/custom_types/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/errors/.cargo/pgx-linker-script.sh b/pgx-examples/errors/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/errors/.cargo/pgx-linker-script.sh +++ b/pgx-examples/errors/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/operators/.cargo/pgx-linker-script.sh b/pgx-examples/operators/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/operators/.cargo/pgx-linker-script.sh +++ b/pgx-examples/operators/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/schemas/.cargo/pgx-linker-script.sh b/pgx-examples/schemas/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/schemas/.cargo/pgx-linker-script.sh +++ b/pgx-examples/schemas/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/shmem/.cargo/pgx-linker-script.sh b/pgx-examples/shmem/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/shmem/.cargo/pgx-linker-script.sh +++ b/pgx-examples/shmem/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/spi/.cargo/pgx-linker-script.sh b/pgx-examples/spi/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/spi/.cargo/pgx-linker-script.sh +++ b/pgx-examples/spi/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/srf/.cargo/pgx-linker-script.sh b/pgx-examples/srf/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/srf/.cargo/pgx-linker-script.sh +++ b/pgx-examples/srf/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/strings/.cargo/pgx-linker-script.sh b/pgx-examples/strings/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/strings/.cargo/pgx-linker-script.sh +++ b/pgx-examples/strings/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-examples/triggers/.cargo/pgx-linker-script.sh b/pgx-examples/triggers/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-examples/triggers/.cargo/pgx-linker-script.sh +++ b/pgx-examples/triggers/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx-tests/.cargo/pgx-linker-script.sh b/pgx-tests/.cargo/pgx-linker-script.sh index 838c3df636..a0aa2563c3 100755 --- a/pgx-tests/.cargo/pgx-linker-script.sh +++ b/pgx-tests/.cargo/pgx-linker-script.sh @@ -2,10 +2,11 @@ # Auto-generated by pgx. You may edit this, or delete it to have a new one created. if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then - if [[ $TARGET == "x86_64-apple-darwin" ]] || [[ $TARGET == "aarch64-apple-darwin" ]]; then + UNAME=$(uname) + if [[ $UNAME == "Darwin" ]]; then TEMP=$(mktemp pgx-XXX) echo "*_pgx_internals_*" > ${TEMP} - gcc -exported_symbols_list=${TEMP} $@ + gcc -exported_symbols_list ${TEMP} $@ rm -rf ${TEMP} else TEMP=$(mktemp pgx-XXX) @@ -15,4 +16,4 @@ if [[ $CARGO_BIN_NAME == "sql-generator" ]]; then fi else gcc -Wl,-undefined,dynamic_lookup $@ -fi +fi \ No newline at end of file diff --git a/pgx/src/datum/sql_entity_graph/pgx_sql.rs b/pgx/src/datum/sql_entity_graph/pgx_sql.rs index 312be4a936..93cd334014 100644 --- a/pgx/src/datum/sql_entity_graph/pgx_sql.rs +++ b/pgx/src/datum/sql_entity_graph/pgx_sql.rs @@ -914,7 +914,11 @@ fn connect_externs( "Could not fetch Builtin Type {}.", iterated_return.1 )); - tracing::debug!(from = %item.rust_identifier(), to = iterated_return.1, "Adding Extern after BuiltIn Type (due to return) edge"); + tracing::debug!( + from = %item.rust_identifier(), + to = iterated_return.1, + "Adding Extern after BuiltIn Type (due to return) edge" + ); graph.add_edge( *builtin_index, index,