Skip to content

drowzy/pgx_fdw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgx-fdw

Experimental Foreign Data Wrapper support for pgx.

Implementing a FDW

  1. Impl the trait pgx_fdw::ForeignData
struct MyFdw {}
impl pgx_fdw::ForeignData for MyFdw {
    ...
}
  1. Create handler function
/// ```sql
/// CREATE FUNCTION my_handler() RETURNS fdw_handler LANGUAGE c AS 'MODULE_PATHNAME', 'my_handler_wrapper';
/// ```
#[pg_extern]
fn my_handler() -> pg_sys::Datum {
    pgx_fdw::FdwState::<MyFdw>::into_datum()
}
  1. Create wrapper + server
CREATE FOREIGN DATA WRAPPER my_handler handler my_handler NO VALIDATOR;
CREATE SERVER my_fdw_srv FOREIGN DATA WRAPPER my_handler OPTIONS (server_option '1', server_option '2');
CREATE FOREIGN TABLE users (
    id text,
    name text,
    email text
) SERVER my_fdw_server OPTIONS (
    table_option '1',
    table_option2 '2'
);

Examples

  • inmem_table - Simple in-memory table fdw using Vec

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages