Skip to content

Commit

Permalink
report warning when set_metadata failed
Browse files Browse the repository at this point in the history
  • Loading branch information
burmecia committed Jun 25, 2024
1 parent 276c798 commit ed169d1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions wrappers/src/stats.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use pgrx::{prelude::*, JsonB};
use std::fmt;
use supabase_wrappers::prelude::report_warning;

// fdw stats table name
const FDW_STATS_TABLE: &str = "wrappers_fdw_stats";
Expand Down Expand Up @@ -102,11 +103,13 @@ pub(crate) fn set_metadata(fdw_name: &str, metadata: Option<JsonB>) {
updated_at = timezone('utc'::text, now())",
get_stats_table()
);
let _ = Spi::run_with_args(
if let Err(err) = Spi::run_with_args(
&sql,
Some(vec![
(PgBuiltInOids::TEXTOID.oid(), fdw_name.into_datum()),
(PgBuiltInOids::JSONBOID.oid(), metadata.into_datum()),
]),
);
) {
report_warning(&format!("set fdw stats metadata failed: {}", err));
};
}

0 comments on commit ed169d1

Please sign in to comment.