-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from supabase/feat/fallible-fdw-trait
Fallible ForeignDataWrapper trait methods
- Loading branch information
Showing
14 changed files
with
545 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
use crate::prelude::*; | ||
use pgrx::pg_sys::panic::{ErrorReport, ErrorReportable}; | ||
use pgrx::prelude::*; | ||
|
||
use super::utils; | ||
|
||
// create a fdw instance | ||
pub(super) unsafe fn create_fdw_instance<W: ForeignDataWrapper>(ftable_id: pg_sys::Oid) -> W { | ||
pub(super) unsafe fn create_fdw_instance<E: Into<ErrorReport>, W: ForeignDataWrapper<E>>( | ||
ftable_id: pg_sys::Oid, | ||
) -> W { | ||
let ftable = pg_sys::GetForeignTable(ftable_id); | ||
let fserver = pg_sys::GetForeignServer((*ftable).serverid); | ||
let fserver_opts = utils::options_to_hashmap((*fserver).options); | ||
W::new(&fserver_opts) | ||
let wrapper = W::new(&fserver_opts); | ||
wrapper.map_err(|e| e.into()).report() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.