diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7e6dca0c..8794a9a99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,8 +37,8 @@ jobs: extension_name: - wrappers pgrx_version: - - 0.11.3 - postgres: [14, 15, 16] + - 0.12.6 + postgres: [14, 15, 16, 17] features: - "all_fdws" box: diff --git a/.github/workflows/test_supabase_wrappers.yml b/.github/workflows/test_supabase_wrappers.yml index 413ae9c0f..7a3e6d9ca 100644 --- a/.github/workflows/test_supabase_wrappers.yml +++ b/.github/workflows/test_supabase_wrappers.yml @@ -40,7 +40,7 @@ jobs: postgresql-server-dev-15 sudo chmod a+rwx `/usr/lib/postgresql/15/bin/pg_config --pkglibdir` `/usr/lib/postgresql/15/bin/pg_config --sharedir`/extension /var/run/postgresql/ - - run: cargo install cargo-pgrx --version 0.11.3 + - run: cargo install cargo-pgrx --version 0.12.6 - run: cargo pgrx init --pg15 /usr/lib/postgresql/15/bin/pg_config - name: Format code diff --git a/.github/workflows/test_wrappers.yml b/.github/workflows/test_wrappers.yml index 98a32419a..a08fed407 100644 --- a/.github/workflows/test_wrappers.yml +++ b/.github/workflows/test_wrappers.yml @@ -47,7 +47,7 @@ jobs: postgresql-server-dev-15 sudo chmod a+rwx `/usr/lib/postgresql/15/bin/pg_config --pkglibdir` `/usr/lib/postgresql/15/bin/pg_config --sharedir`/extension /var/run/postgresql/ - - run: cargo install cargo-pgrx --version 0.11.3 + - run: cargo install cargo-pgrx --version 0.12.6 - run: cargo pgrx init --pg15 /usr/lib/postgresql/15/bin/pg_config - name: Format code @@ -102,7 +102,7 @@ jobs: postgresql-server-dev-15 sudo chmod a+rwx `/usr/lib/postgresql/15/bin/pg_config --pkglibdir` `/usr/lib/postgresql/15/bin/pg_config --sharedir`/extension /var/run/postgresql/ - - run: cargo install cargo-pgrx --version 0.11.3 + - run: cargo install cargo-pgrx --version 0.12.6 - run: cargo pgrx init --pg15 /usr/lib/postgresql/15/bin/pg_config - run: cargo install cargo-component --version 0.13.2 - run: rustup target add wasm32-unknown-unknown diff --git a/Cargo.lock b/Cargo.lock index cf651e1b4..5c8e5ffb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,6 +99,16 @@ dependencies = [ "libc", ] +[[package]] +name = "annotate-snippets" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccaf7e9dfbb6ab22c82e473cd1a8a7bd313c19a5b7e40970f3d89ef5a5c9e81e" +dependencies = [ + "unicode-width", + "yansi-term", +] + [[package]] name = "ansi_term" version = "0.12.1" @@ -554,15 +564,6 @@ dependencies = [ "num-traits 0.2.19", ] -[[package]] -name = "atomic-polyfill" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" -dependencies = [ - "critical-section", -] - [[package]] name = "atomic-traits" version = "0.3.0" @@ -1062,16 +1063,15 @@ checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ + "annotate-snippets", "bitflags 2.5.0", "cexpr", "clang-sys", "itertools 0.12.1", - "lazy_static 1.4.0", - "lazycell", "proc-macro2", "quote", "regex", @@ -1300,11 +1300,43 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde 1.0.202", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde 1.0.202", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde 1.0.202", + "serde_json", + "thiserror", +] + [[package]] name = "cargo_toml" -version = "0.16.3" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3f9629bc6c4388ea699781dc988c2b99766d7679b151c81990b4fa1208fafd3" +checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" dependencies = [ "serde 1.0.202", "toml 0.8.13", @@ -1321,6 +1353,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "cee-scape" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d67dfb052149f779f77e9ce089cea126e00657e8f0d11dafc7901fde4291101" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "cexpr" version = "0.6.0" @@ -1433,12 +1475,13 @@ dependencies = [ [[package]] name = "clap-cargo" -version = "0.11.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25122ca6ebad5f53578c26638afd9f0160426969970dc37ec6c363ff6b082ebd" +checksum = "23b2ea69cefa96b848b73ad516ad1d59a195cdf9263087d977f648a818c8b43e" dependencies = [ + "anstyle", + "cargo_metadata", "clap", - "doc-comment", ] [[package]] @@ -1780,12 +1823,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "critical-section" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" - [[package]] name = "crossbeam" version = "0.8.4" @@ -2071,12 +2108,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - [[package]] name = "dyn-clone" version = "1.0.17" @@ -2769,9 +2800,9 @@ dependencies = [ [[package]] name = "hash32" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" dependencies = [ "byteorder", ] @@ -2806,14 +2837,11 @@ dependencies = [ [[package]] name = "heapless" -version = "0.7.17" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ - "atomic-polyfill", "hash32", - "rustc_version 0.4.0", - "spin 0.9.8", "stable_deref_trait", ] @@ -2844,6 +2872,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + [[package]] name = "hex" version = "0.4.3" @@ -2892,6 +2926,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "hostname" version = "0.3.1" @@ -3229,6 +3272,23 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "is-terminal" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" +dependencies = [ + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + [[package]] name = "is_terminal_polyfill" version = "1.70.0" @@ -3346,12 +3406,6 @@ dependencies = [ "spin 0.5.2", ] -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "leb128" version = "0.2.5" @@ -4067,9 +4121,13 @@ checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" [[package]] name = "owo-colors" -version = "3.5.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" +dependencies = [ + "supports-color 2.1.0", + "supports-color 3.0.1", +] [[package]] name = "p256" @@ -4301,9 +4359,9 @@ dependencies = [ [[package]] name = "pgrx" -version = "0.11.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2102faa5ef4a7bf096fefcf67692b293583efd18f9236340ad3169807dfc2b73" +checksum = "29fd8bef6f9f963a224b6d92033aa75581ecf01c8a815eb6dea0ad7260ac4541" dependencies = [ "atomic-traits", "bitflags 2.5.0", @@ -4316,7 +4374,6 @@ dependencies = [ "pgrx-pg-sys", "pgrx-sql-entity-graph", "seahash", - "seq-macro", "serde 1.0.202", "serde_cbor", "serde_json", @@ -4324,86 +4381,96 @@ dependencies = [ "uuid", ] +[[package]] +name = "pgrx-bindgen" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb9cd617058bad2d78e31c55b58d2b003dcf039cba125b8e018c0f72562fb951" +dependencies = [ + "bindgen", + "cc", + "clang-sys", + "eyre", + "pgrx-pg-config", + "proc-macro2", + "quote", + "shlex", + "syn 2.0.65", + "walkdir", +] + [[package]] name = "pgrx-macros" -version = "0.11.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c26810d09910ec987a6708d48d243efb5f879331e01c6fec0893714d0eb12bae" +checksum = "cbf074a98b59d1811b29c97e58d7ec5cab00445c7a5d7ed4153d746eb8572d55" dependencies = [ "pgrx-sql-entity-graph", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.65", ] [[package]] name = "pgrx-pg-config" -version = "0.11.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0099ba4b635dfe1e34afc8bca8be43e9577c5d726aaf1dc7dd23a78f6c8a60" +checksum = "a82140784390a8f7f8a4f36acc6c04d177f59666012fa419eb03ab90201945ef" dependencies = [ "cargo_toml", - "dirs", "eyre", + "home", "owo-colors", "pathsearch", "serde 1.0.202", - "serde_derive", "serde_json", + "thiserror", "toml 0.8.13", "url", ] [[package]] name = "pgrx-pg-sys" -version = "0.11.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f40315259c41fede51eb23b791b48d0a112b0f47d0dcb6862b798d1fa1db6ea" +checksum = "6a0b49de7e28fdf7eb9ace7b736c2527330441efd35e55768fa26c637366d1c3" dependencies = [ - "bindgen", - "clang-sys", - "eyre", + "cee-scape", "libc", - "memoffset 0.9.1", - "once_cell", + "pgrx-bindgen", "pgrx-macros", - "pgrx-pg-config", "pgrx-sql-entity-graph", - "proc-macro2", - "quote", "serde 1.0.202", - "shlex", "sptr", - "syn 1.0.109", - "walkdir", ] [[package]] name = "pgrx-sql-entity-graph" -version = "0.11.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d47a4e991c8c66162c5d6b0fc2bd382e43a58fc893ce05a6a15ddcb1bf7eee4" +checksum = "dbf0cb2b4c8204678cf3dfc71bd0febe11dd4a6636b1971c3ee595d58d2db5f6" dependencies = [ "convert_case", "eyre", "petgraph", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.65", + "thiserror", "unescape", ] [[package]] name = "pgrx-tests" -version = "0.11.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3abc01e2bb930b072bd660d04c8eaa69a29d4727d5b2a641f946c603c1605e" +checksum = "207fa953e4634371ff00e20584e80b1faf0c381fb7bec14648ce9076494582de" dependencies = [ "clap-cargo", "eyre", "libc", - "once_cell", "owo-colors", + "paste", "pgrx", "pgrx-macros", "pgrx-pg-config", @@ -5999,9 +6066,6 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] [[package]] name = "spki" @@ -6098,6 +6162,25 @@ dependencies = [ "rsa", ] +[[package]] +name = "supports-color" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89" +dependencies = [ + "is-terminal", + "is_ci", +] + +[[package]] +name = "supports-color" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8775305acf21c96926c900ad056abeef436701108518cf890020387236ac5a77" +dependencies = [ + "is_ci", +] + [[package]] name = "syn" version = "1.0.109" @@ -6140,9 +6223,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sysinfo" -version = "0.29.11" +version = "0.30.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" +checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" dependencies = [ "cfg-if", "core-foundation-sys", @@ -6150,7 +6233,7 @@ dependencies = [ "ntapi", "once_cell", "rayon", - "winapi", + "windows", ] [[package]] @@ -7431,6 +7514,16 @@ dependencies = [ "wasmtime-environ", ] +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.5", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -7747,6 +7840,15 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "yansi-term" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1" +dependencies = [ + "winapi", +] + [[package]] name = "yup-oauth2" version = "8.3.2" diff --git a/supabase-wrappers-macros/src/lib.rs b/supabase-wrappers-macros/src/lib.rs index 48713c8e4..ae2cd1fe7 100644 --- a/supabase-wrappers-macros/src/lib.rs +++ b/supabase-wrappers-macros/src/lib.rs @@ -96,7 +96,7 @@ pub fn wrappers_fdw(attr: TokenStream, item: TokenStream) -> TokenStream { fn #fn_validator_ident(options: Vec>, catalog: Option) { #ident::validator(options, catalog) .map_err(|e| >::into(e)) - .report(); + .unwrap_or_report(); } pub(super) fn #fn_get_meta_ident() -> HashMap { diff --git a/supabase-wrappers/Cargo.toml b/supabase-wrappers/Cargo.toml index b4a46e3ca..eb104e7a4 100644 --- a/supabase-wrappers/Cargo.toml +++ b/supabase-wrappers/Cargo.toml @@ -17,17 +17,18 @@ pg13 = ["pgrx/pg13", "pgrx-tests/pg13"] pg14 = ["pgrx/pg14", "pgrx-tests/pg14"] pg15 = ["pgrx/pg15", "pgrx-tests/pg15"] pg16 = ["pgrx/pg16", "pgrx-tests/pg16"] +pg17 = ["pgrx/pg17", "pgrx-tests/pg17" ] pg_test = [] [dependencies] -pgrx = { version = "=0.11.3", default-features = false } +pgrx = { version = "=0.12.6", default-features = false } thiserror = "1.0.48" tokio = { version = "1.35", features = ["rt", "net"] } uuid = { version = "1.2.2" } supabase-wrappers-macros = { version = "0.1", path = "../supabase-wrappers-macros" } [dev-dependencies] -pgrx-tests = "=0.11.3" +pgrx-tests = "=0.12.6" [package.metadata.docs.rs] features = ["pg15", "cshim"] diff --git a/supabase-wrappers/src/import_foreign_schema.rs b/supabase-wrappers/src/import_foreign_schema.rs index 90f8958a7..4ea26dfe6 100644 --- a/supabase-wrappers/src/import_foreign_schema.rs +++ b/supabase-wrappers/src/import_foreign_schema.rs @@ -26,9 +26,9 @@ impl, W: ForeignDataWrapper> FdwState { #[repr(u32)] #[derive(Debug, Clone)] pub enum ListType { - FdwImportSchemaAll = pgrx::pg_sys::ImportForeignSchemaType_FDW_IMPORT_SCHEMA_ALL, - FdwImportSchemaLimitTo = pgrx::pg_sys::ImportForeignSchemaType_FDW_IMPORT_SCHEMA_LIMIT_TO, - FdwImportSchemaExcept = pgrx::pg_sys::ImportForeignSchemaType_FDW_IMPORT_SCHEMA_EXCEPT, + FdwImportSchemaAll = pgrx::pg_sys::ImportForeignSchemaType::FDW_IMPORT_SCHEMA_ALL, + FdwImportSchemaLimitTo = pgrx::pg_sys::ImportForeignSchemaType::FDW_IMPORT_SCHEMA_LIMIT_TO, + FdwImportSchemaExcept = pgrx::pg_sys::ImportForeignSchemaType::FDW_IMPORT_SCHEMA_EXCEPT, } #[derive(Debug, Clone)] @@ -66,13 +66,13 @@ pub(super) extern "C" fn import_foreign_schema, W: ForeignD .to_string(), list_type: match (*stmt).list_type { - pgrx::pg_sys::ImportForeignSchemaType_FDW_IMPORT_SCHEMA_ALL => { + pgrx::pg_sys::ImportForeignSchemaType::FDW_IMPORT_SCHEMA_ALL => { ListType::FdwImportSchemaAll } - pgrx::pg_sys::ImportForeignSchemaType_FDW_IMPORT_SCHEMA_LIMIT_TO => { + pgrx::pg_sys::ImportForeignSchemaType::FDW_IMPORT_SCHEMA_LIMIT_TO => { ListType::FdwImportSchemaLimitTo } - pgrx::pg_sys::ImportForeignSchemaType_FDW_IMPORT_SCHEMA_EXCEPT => { + pgrx::pg_sys::ImportForeignSchemaType::FDW_IMPORT_SCHEMA_EXCEPT => { ListType::FdwImportSchemaExcept } // This should not happen, it's okay to default to FdwImportSchemaAll diff --git a/supabase-wrappers/src/qual.rs b/supabase-wrappers/src/qual.rs index 2c3115ef7..0de762c47 100644 --- a/supabase-wrappers/src/qual.rs +++ b/supabase-wrappers/src/qual.rs @@ -1,6 +1,13 @@ use crate::prelude::*; use pgrx::pg_sys::Oid; -use pgrx::{is_a, list::PgList, pg_sys, pg_sys::Datum, FromDatum, PgBuiltInOids, PgOid}; +use pgrx::{ + datum::{Array, Date, JsonB, Timestamp}, + is_a, + list::PgList, + pg_sys, + pg_sys::Datum, + FromDatum, PgBuiltInOids, PgOid, +}; use std::ffi::CStr; use std::os::raw::c_int; @@ -12,44 +19,97 @@ pub(crate) unsafe fn form_array_from_datum( is_null: bool, typoid: pg_sys::Oid, ) -> Option> { - if is_null { - return None; - } - let oid = PgOid::from(typoid); match oid { PgOid::BuiltIn(PgBuiltInOids::BOOLARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::BOOLOID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::BOOLOID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::Bool(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::CHARARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::CHAROID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::CHAROID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::I8(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::INT2ARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::INT2OID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::INT2OID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::I16(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::FLOAT4ARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::FLOAT4OID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::FLOAT4OID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::F32(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::INT4ARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::INT4OID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::INT4OID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::I32(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::FLOAT8ARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::FLOAT8OID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::FLOAT8OID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::F64(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::INT8ARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::INT8OID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::INT8OID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::I64(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::TEXTARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::TEXTOID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::TEXTOID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::String(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::DATEARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::DATEOID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::DATEOID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::Date(v.expect("non-null array element"))) + .collect::>() + }) } PgOid::BuiltIn(PgBuiltInOids::TIMESTAMPARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::TIMESTAMPOID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::TIMESTAMPOID).map( + |arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::Timestamp(v.expect("non-null array element"))) + .collect::>() + }, + ) } PgOid::BuiltIn(PgBuiltInOids::JSONBARRAYOID) => { - Vec::::from_polymorphic_datum(datum, false, pg_sys::JSONBOID) + Array::::from_polymorphic_datum(datum, is_null, pg_sys::JSONBOID).map(|arr| { + arr.iter() + .filter(|v| v.is_some()) + .map(|v| Cell::Json(v.expect("non-null array element"))) + .collect::>() + }) } _ => None, } @@ -57,12 +117,12 @@ pub(crate) unsafe fn form_array_from_datum( pub(crate) unsafe fn get_operator(opno: pg_sys::Oid) -> pg_sys::Form_pg_operator { let htup = pg_sys::SearchSysCache1( - pg_sys::SysCacheIdentifier_OPEROID.try_into().unwrap(), + pg_sys::SysCacheIdentifier::OPEROID.try_into().unwrap(), opno.into(), ); if htup.is_null() { pg_sys::ReleaseSysCache(htup); - pgrx::error!("cache lookup operator {} failed", opno); + pgrx::error!("cache lookup operator {:?} failed", opno); } let op = pg_sys::GETSTRUCT(htup) as pg_sys::Form_pg_operator; pg_sys::ReleaseSysCache(htup); @@ -172,7 +232,7 @@ pub(crate) unsafe fn extract_from_null_test( let field = pg_sys::get_attname(baserel_id, (*var).varattno, false); - let opname = if (*expr).nulltesttype == pg_sys::NullTestType_IS_NULL { + let opname = if (*expr).nulltesttype == pg_sys::NullTestType::IS_NULL { "is".to_string() } else { "is not".to_string() @@ -278,7 +338,7 @@ pub(crate) unsafe fn extract_from_bool_expr( ) -> Option { let args: PgList = PgList::from_pg((*expr).args); - if (*expr).boolop != pg_sys::BoolExprType_NOT_EXPR || args.len() != 1 { + if (*expr).boolop != pg_sys::BoolExprType::NOT_EXPR || args.len() != 1 { return None; } @@ -315,10 +375,10 @@ pub(crate) unsafe fn extract_from_boolean_test( let field = pg_sys::get_attname(baserel_id, (*var).varattno, false); let (opname, value) = match (*expr).booltesttype { - pg_sys::BoolTestType_IS_TRUE => ("is".to_string(), true), - pg_sys::BoolTestType_IS_FALSE => ("is".to_string(), false), - pg_sys::BoolTestType_IS_NOT_TRUE => ("is not".to_string(), true), - pg_sys::BoolTestType_IS_NOT_FALSE => ("is not".to_string(), false), + pg_sys::BoolTestType::IS_TRUE => ("is".to_string(), true), + pg_sys::BoolTestType::IS_FALSE => ("is".to_string(), false), + pg_sys::BoolTestType::IS_NOT_TRUE => ("is not".to_string(), true), + pg_sys::BoolTestType::IS_NOT_FALSE => ("is not".to_string(), false), _ => return None, }; diff --git a/supabase-wrappers/src/scan.rs b/supabase-wrappers/src/scan.rs index e2f5e7ca3..260ee0fa7 100644 --- a/supabase-wrappers/src/scan.rs +++ b/supabase-wrappers/src/scan.rs @@ -185,6 +185,8 @@ pub(super) extern "C" fn get_foreign_paths, W: ForeignDataW ptr::null_mut(), // no pathkeys ptr::null_mut(), // no outer rel either ptr::null_mut(), // no extra plan + #[cfg(feature = "pg17")] + ptr::null_mut(), // no restrict info ptr::null_mut(), // no fdw_private data ); pg_sys::add_path(baserel, &mut ((*path).path)); diff --git a/supabase-wrappers/src/utils.rs b/supabase-wrappers/src/utils.rs index 612d07131..5cf40e516 100644 --- a/supabase-wrappers/src/utils.rs +++ b/supabase-wrappers/src/utils.rs @@ -338,6 +338,6 @@ impl> ReportableError for Result { type Output = T; fn report_unwrap(self) -> Self::Output { - self.map_err(|e| e.into()).report() + self.map_err(|e| e.into()).unwrap_or_report() } } diff --git a/wrappers/Cargo.toml b/wrappers/Cargo.toml index fec85b375..90bb6a1a1 100644 --- a/wrappers/Cargo.toml +++ b/wrappers/Cargo.toml @@ -5,7 +5,11 @@ edition = "2021" publish = false [lib] -crate-type = ["cdylib"] +crate-type = ["cdylib", "lib"] + +[[bin]] +name = "pgrx_embed_wrappers" +path = "./src/bin/pgrx_embed.rs" [features] default = ["cshim", "pg15"] @@ -14,6 +18,7 @@ pg13 = ["pgrx/pg13", "pgrx-tests/pg13", "supabase-wrappers/pg13"] pg14 = ["pgrx/pg14", "pgrx-tests/pg14", "supabase-wrappers/pg14"] pg15 = ["pgrx/pg15", "pgrx-tests/pg15", "supabase-wrappers/pg15"] pg16 = ["pgrx/pg16", "pgrx-tests/pg16", "supabase-wrappers/pg16"] +pg17 = ["pgrx/pg17", "pgrx-tests/pg17", "supabase-wrappers/pg17"] pg_test = [] helloworld_fdw = [] @@ -155,7 +160,7 @@ all_fdws = [ ] [dependencies] -pgrx = { version = "=0.11.3" } +pgrx = { version = "=0.12.6" } #supabase-wrappers = "0.1" supabase-wrappers = { path = "../supabase-wrappers", default-features = false } @@ -241,4 +246,4 @@ thiserror = { version = "1.0.48", optional = true } anyhow = { version = "1.0.81", optional = true } [dev-dependencies] -pgrx-tests = "=0.11.3" +pgrx-tests = "=0.12.6" diff --git a/wrappers/src/bin/pgrx_embed.rs b/wrappers/src/bin/pgrx_embed.rs new file mode 100644 index 000000000..5f5c4d858 --- /dev/null +++ b/wrappers/src/bin/pgrx_embed.rs @@ -0,0 +1 @@ +::pgrx::pgrx_embed!(); diff --git a/wrappers/src/fdw/airtable_fdw/README.md b/wrappers/src/fdw/airtable_fdw/README.md index 8889bc49f..2f7323c81 100644 --- a/wrappers/src/fdw/airtable_fdw/README.md +++ b/wrappers/src/fdw/airtable_fdw/README.md @@ -11,6 +11,7 @@ This is a foreign data wrapper for [Airtable](https://www.airtable.com). It is d | Version | Date | Notes | | ------- | ---------- | ---------------------------------------------------- | +| 0.1.4 | 2024-09-30 | Support for pgrx 0.12.6 | | 0.1.3 | 2023-10-20 | Added jsonb data types support | | 0.1.2 | 2023-07-19 | Added more data types support | | 0.1.1 | 2023-07-13 | Added fdw stats collection | diff --git a/wrappers/src/fdw/airtable_fdw/airtable_fdw.rs b/wrappers/src/fdw/airtable_fdw/airtable_fdw.rs index f0417ec9e..ec6eb982a 100644 --- a/wrappers/src/fdw/airtable_fdw/airtable_fdw.rs +++ b/wrappers/src/fdw/airtable_fdw/airtable_fdw.rs @@ -28,7 +28,7 @@ fn create_client(api_key: &str) -> Result("timestamp_field") + r.get_by_name::("timestamp_field") .expect("timestamp_field is missing") .map(|v| v.to_iso_string()) }) diff --git a/wrappers/src/fdw/bigquery_fdw/README.md b/wrappers/src/fdw/bigquery_fdw/README.md index 2bb39722b..668122b0e 100644 --- a/wrappers/src/fdw/bigquery_fdw/README.md +++ b/wrappers/src/fdw/bigquery_fdw/README.md @@ -11,6 +11,7 @@ This is a foreign data wrapper for [BigQuery](https://cloud.google.com/bigquery) | Version | Date | Notes | | ------- | ---------- | ---------------------------------------------------- | +| 0.1.5 | 2024-09-30 | Support for pgrx 0.12.6 | | 0.1.4 | 2023-07-13 | Added fdw stats collection | | 0.1.3 | 2023-04-03 | Added support for `NUMERIC` type | | 0.1.2 | 2023-03-15 | Added subquery support for `table` option | diff --git a/wrappers/src/fdw/bigquery_fdw/bigquery_fdw.rs b/wrappers/src/fdw/bigquery_fdw/bigquery_fdw.rs index 532e5862a..8f79105c0 100644 --- a/wrappers/src/fdw/bigquery_fdw/bigquery_fdw.rs +++ b/wrappers/src/fdw/bigquery_fdw/bigquery_fdw.rs @@ -38,7 +38,7 @@ fn field_to_cell(rs: &ResultSet, field: &TableFieldSchema) -> BigQueryFdwResult< None => None, }, FieldType::Timestamp => rs.get_f64_by_name(&field.name)?.map(|v| { - let ts = pgrx::to_timestamp(v); + let ts = pgrx::prelude::to_timestamp(v); Cell::Timestamp(ts.to_utc()) }), _ => { @@ -50,7 +50,7 @@ fn field_to_cell(rs: &ResultSet, field: &TableFieldSchema) -> BigQueryFdwResult< } #[wrappers_fdw( - version = "0.1.4", + version = "0.1.5", author = "Supabase", website = "https://github.com/supabase/wrappers/tree/main/wrappers/src/fdw/bigquery_fdw", error_type = "BigQueryFdwError" diff --git a/wrappers/src/fdw/bigquery_fdw/mod.rs b/wrappers/src/fdw/bigquery_fdw/mod.rs index 4f37bf791..71e6279b5 100644 --- a/wrappers/src/fdw/bigquery_fdw/mod.rs +++ b/wrappers/src/fdw/bigquery_fdw/mod.rs @@ -2,7 +2,7 @@ use gcp_bigquery_client::error::BQError; use pgrx::pg_sys::panic::ErrorReport; -use pgrx::{DateTimeConversionError, PgSqlErrorCode}; +use pgrx::{prelude::DateTimeConversionError, PgSqlErrorCode}; use supabase_wrappers::prelude::{CreateRuntimeError, OptionsError}; use thiserror::Error; diff --git a/wrappers/src/fdw/clickhouse_fdw/README.md b/wrappers/src/fdw/clickhouse_fdw/README.md index 92a555b11..05edb0cd9 100644 --- a/wrappers/src/fdw/clickhouse_fdw/README.md +++ b/wrappers/src/fdw/clickhouse_fdw/README.md @@ -11,6 +11,7 @@ This is a foreign data wrapper for [ClickHouse](https://clickhouse.com/). It is | Version | Date | Notes | | ------- | ---------- | ---------------------------------------------------- | +| 0.1.5 | 2024-09-30 | Support for pgrx 0.12.6 | | 0.1.4 | 2024-09-10 | Added Nullable type suppport | | 0.1.3 | 2023-07-17 | Added sort and limit pushdown suppport | | 0.1.2 | 2023-07-13 | Added fdw stats collection | diff --git a/wrappers/src/fdw/clickhouse_fdw/clickhouse_fdw.rs b/wrappers/src/fdw/clickhouse_fdw/clickhouse_fdw.rs index d13b817a4..427e47c67 100644 --- a/wrappers/src/fdw/clickhouse_fdw/clickhouse_fdw.rs +++ b/wrappers/src/fdw/clickhouse_fdw/clickhouse_fdw.rs @@ -2,7 +2,7 @@ use crate::stats; #[allow(deprecated)] use chrono::{DateTime, Datelike, NaiveDate, NaiveDateTime, Utc}; use clickhouse_rs::{types, types::Block, types::SqlType, ClientHandle, Pool}; -use pgrx::to_timestamp; +use pgrx::prelude::to_timestamp; use regex::{Captures, Regex}; use std::collections::HashMap; @@ -56,7 +56,8 @@ fn field_to_cell(row: &types::Row, i: usize) -> ClickHouseFdwRes } SqlType::Date => { let value = row.get::(i)?; - let dt = pgrx::Date::new(value.year(), value.month() as u8, value.day() as u8)?; + let dt = + pgrx::prelude::Date::new(value.year(), value.month() as u8, value.day() as u8)?; Ok(Some(Cell::Date(dt))) } SqlType::DateTime(_) => { @@ -108,7 +109,7 @@ fn field_to_cell(row: &types::Row, i: usize) -> ClickHouseFdwRes SqlType::Date => { let value = row.get::, usize>(i)?; Ok(value - .map(|t| pgrx::Date::new(t.year(), t.month() as u8, t.day() as u8)) + .map(|t| pgrx::prelude::Date::new(t.year(), t.month() as u8, t.day() as u8)) .transpose()? .map(Cell::Date)) } @@ -130,7 +131,7 @@ fn field_to_cell(row: &types::Row, i: usize) -> ClickHouseFdwRes } #[wrappers_fdw( - version = "0.1.4", + version = "0.1.5", author = "Supabase", website = "https://github.com/supabase/wrappers/tree/main/wrappers/src/fdw/clickhouse_fdw", error_type = "ClickHouseFdwError" diff --git a/wrappers/src/fdw/cognito_fdw/README.md b/wrappers/src/fdw/cognito_fdw/README.md index 1f1a0f08e..63ec6a44d 100644 --- a/wrappers/src/fdw/cognito_fdw/README.md +++ b/wrappers/src/fdw/cognito_fdw/README.md @@ -10,4 +10,5 @@ This is a demo foreign data wrapper which is developed using [Wrappers](https:// | Version | Date | Notes | | ------- | ---------- | ---------------------------------------------------- | +| 0.1.2 | 2024-09-30 | Support for pgrx 0.12.6 | | 0.1.0 | 2024-01-25 | Initial version | diff --git a/wrappers/src/fdw/cognito_fdw/cognito_client/row.rs b/wrappers/src/fdw/cognito_fdw/cognito_client/row.rs index d10b42dcd..4f0c10e50 100644 --- a/wrappers/src/fdw/cognito_fdw/cognito_client/row.rs +++ b/wrappers/src/fdw/cognito_fdw/cognito_client/row.rs @@ -71,10 +71,9 @@ impl IntoRow for UserType { if let Some(created_at) = self.extract_attribute_value("created_at") { let parsed_date = DateTime::parse_from_rfc3339(&created_at) .expect("Failed to parse date"); - row.push( - "created_at", - Some(Cell::Timestamp(parsed_date.timestamp().into())), - ); + let ts = pgrx::prelude::Timestamp::try_from(parsed_date.timestamp()) + .expect("valid timestamp"); + row.push("created_at", Some(Cell::Timestamp(ts))); } } "email" => { diff --git a/wrappers/src/fdw/cognito_fdw/cognito_fdw.rs b/wrappers/src/fdw/cognito_fdw/cognito_fdw.rs index 9644d44e7..74341b69b 100644 --- a/wrappers/src/fdw/cognito_fdw/cognito_fdw.rs +++ b/wrappers/src/fdw/cognito_fdw/cognito_fdw.rs @@ -16,7 +16,7 @@ use pgrx::PgSqlErrorCode; use thiserror::Error; #[wrappers_fdw( - version = "0.1.1", + version = "0.1.2", author = "Joel", website = "https://github.com/supabase/wrappers/tree/main/wrappers/src/fdw/cognito_fdw", error_type = "CognitoFdwError" diff --git a/wrappers/src/fdw/mssql_fdw/README.md b/wrappers/src/fdw/mssql_fdw/README.md index 82aa4fde3..fcf53c186 100644 --- a/wrappers/src/fdw/mssql_fdw/README.md +++ b/wrappers/src/fdw/mssql_fdw/README.md @@ -10,6 +10,7 @@ This is a foreign data wrapper for [Microsoft SQL Server](https://www.microsoft. | Version | Date | Notes | | ------- | ---------- | ---------------------------------------------------- | +| 0.1.2 | 2024-09-30 | Support for pgrx 0.12.6 | | 0.1.1 | 2024-09-09 | Add boolean test qual support | | 0.1.0 | 2023-12-27 | Initial version | diff --git a/wrappers/src/fdw/mssql_fdw/mssql_fdw.rs b/wrappers/src/fdw/mssql_fdw/mssql_fdw.rs index d8f5ecd78..2610a66d4 100644 --- a/wrappers/src/fdw/mssql_fdw/mssql_fdw.rs +++ b/wrappers/src/fdw/mssql_fdw/mssql_fdw.rs @@ -1,6 +1,6 @@ use crate::stats; use num_traits::cast::ToPrimitive; -use pgrx::{to_timestamp, PgBuiltInOids, PgOid}; +use pgrx::{prelude::to_timestamp, PgBuiltInOids, PgOid}; use std::collections::HashMap; use tiberius::{ numeric::Decimal, @@ -57,7 +57,7 @@ fn field_to_cell(src_row: &tiberius::Row, tgt_col: &Column) -> MssqlFdwResult { @@ -93,7 +93,7 @@ impl CellFormatter for MssqlCellFormatter { } #[wrappers_fdw( - version = "0.1.1", + version = "0.1.2", author = "Supabase", website = "https://github.com/supabase/wrappers/tree/main/wrappers/src/fdw/mssql_fdw", error_type = "MssqlFdwError" diff --git a/wrappers/src/fdw/stripe_fdw/tests.rs b/wrappers/src/fdw/stripe_fdw/tests.rs index e2c340d1a..1d65d9b8a 100644 --- a/wrappers/src/fdw/stripe_fdw/tests.rs +++ b/wrappers/src/fdw/stripe_fdw/tests.rs @@ -572,7 +572,10 @@ mod tests { .collect::>(); assert_eq!( results, - vec![("cus_QXg1o8vcGmoR32", Timestamp::from(287883090000000i64))] + vec![( + "cus_QXg1o8vcGmoR32", + Timestamp::try_from(287883090000000i64).unwrap() + )] ); let results = c @@ -846,9 +849,9 @@ mod tests { vec![( ( ("cus_QXg1o8vcGmoR32", "usd"), - Timestamp::from(287883090000000i64) + Timestamp::try_from(287883090000000i64).unwrap() ), - Timestamp::from(287883090000000i64) + Timestamp::try_from(287883090000000i64).unwrap() )] ); diff --git a/wrappers/src/fdw/wasm_fdw/README.md b/wrappers/src/fdw/wasm_fdw/README.md index 7d99150fc..edefea29f 100644 --- a/wrappers/src/fdw/wasm_fdw/README.md +++ b/wrappers/src/fdw/wasm_fdw/README.md @@ -6,6 +6,7 @@ This is Wasm foreign data wrapper host, please visit each Wasm foreign data wrap | Version | Date | Notes | | ------- | ---------- | ---------------------------------------------------- | +| 0.1.3 | 2024-09-30 | Support for pgrx 0.12.6 | | 0.1.2 | 2024-07-07 | Add fdw_package_checksum server option | | 0.1.1 | 2024-07-05 | Fix missing wasm package cache dir issue | | 0.1.0 | 2024-07-03 | Initial version | diff --git a/wrappers/src/fdw/wasm_fdw/bindings.rs b/wrappers/src/fdw/wasm_fdw/bindings.rs index c6ad81ea0..f31051da2 100644 --- a/wrappers/src/fdw/wasm_fdw/bindings.rs +++ b/wrappers/src/fdw/wasm_fdw/bindings.rs @@ -38,13 +38,12 @@ impl TryFrom for HostCell { Ok(Self::Date(Date::from(ts))) } // convert 'pg epoch' (2000-01-01 00:00:00) to unix epoch - GuestCell::Timestamp(v) => { - Ok(Self::Timestamp(Timestamp::from(v - 946_684_800_000_000))) - } - GuestCell::Timestamptz(v) => { - let ts = Timestamp::from(v - 946_684_800_000_000); - Ok(Self::Timestamptz(TimestampWithTimeZone::from(ts))) - } + GuestCell::Timestamp(v) => Timestamp::try_from(v - 946_684_800_000_000) + .map(Self::Timestamp) + .map_err(Self::Error::msg), + GuestCell::Timestamptz(v) => TimestampWithTimeZone::try_from(v - 946_684_800_000_000) + .map(Self::Timestamptz) + .map_err(Self::Error::msg), GuestCell::Json(v) => { let ret = serde_json::from_str(&v).map(|j| Self::Json(JsonB(j)))?; Ok(ret) diff --git a/wrappers/src/fdw/wasm_fdw/tests.rs b/wrappers/src/fdw/wasm_fdw/tests.rs index b177c7dcf..26220bbca 100644 --- a/wrappers/src/fdw/wasm_fdw/tests.rs +++ b/wrappers/src/fdw/wasm_fdw/tests.rs @@ -19,7 +19,7 @@ mod tests { r#"CREATE SERVER snowflake_server FOREIGN DATA WRAPPER wasm_wrapper OPTIONS ( - fdw_package_url 'file://../../wasm-wrappers/fdw/snowflake_fdw/target/wasm32-unknown-unknown/release/snowflake_fdw.wasm', + fdw_package_url 'file:///home/runner/work/wrappers/wrappers/wasm-wrappers/fdw/snowflake_fdw/target/wasm32-unknown-unknown/release/snowflake_fdw.wasm', fdw_package_name 'supabase:snowflake-fdw', fdw_package_version '>=0.1.0', api_url 'http://localhost:8096/snowflake/{}', @@ -64,7 +64,7 @@ mod tests { r#"CREATE SERVER paddle_server FOREIGN DATA WRAPPER wasm_wrapper OPTIONS ( - fdw_package_url 'file://../../wasm-wrappers/fdw/paddle_fdw/target/wasm32-unknown-unknown/release/paddle_fdw.wasm', + fdw_package_url 'file:///home/runner/work/wrappers/wrappers/wasm-wrappers/fdw/paddle_fdw/target/wasm32-unknown-unknown/release/paddle_fdw.wasm', fdw_package_name 'supabase:paddle-fdw', fdw_package_version '>=0.1.0', api_url 'http://localhost:8096/paddle', @@ -113,7 +113,7 @@ mod tests { r#"CREATE SERVER notion_server FOREIGN DATA WRAPPER wasm_wrapper OPTIONS ( - fdw_package_url 'file://../../wasm-wrappers/fdw/notion_fdw/target/wasm32-unknown-unknown/release/notion_fdw.wasm', + fdw_package_url 'file:///home/runner/work/wrappers/wrappers/wasm-wrappers/fdw/notion_fdw/target/wasm32-unknown-unknown/release/notion_fdw.wasm', fdw_package_name 'supabase:notion-fdw', fdw_package_version '>=0.1.0', api_url 'http://localhost:8096/notion', diff --git a/wrappers/src/fdw/wasm_fdw/wasm_fdw.rs b/wrappers/src/fdw/wasm_fdw/wasm_fdw.rs index c11621277..315344b32 100644 --- a/wrappers/src/fdw/wasm_fdw/wasm_fdw.rs +++ b/wrappers/src/fdw/wasm_fdw/wasm_fdw.rs @@ -107,15 +107,14 @@ fn download_component( fs::write(&path, bytes)?; } - Ok(Component::from_file(engine, &path).map_err(|err| { + Ok(Component::from_file(engine, &path).inspect_err(|_| { // remove the cache file if it cannot be loaded as component let _ = fs::remove_file(&path); - err })?) } #[wrappers_fdw( - version = "0.1.2", + version = "0.1.3", author = "Supabase", website = "https://github.com/supabase/wrappers/tree/main/wrappers/src/fdw/wasm_fdw", error_type = "WasmFdwError"