Using a Custom Protocol

    You can create a custom protocol whenever the available built-in protocols do not suffice for a particular need. For example, you could connect Greenplum Database in parallel to another system directly, and stream data from one to the other without the need to materialize the data on disk or use an intermediate process such as gpfdist.

    1. Author the send, receive, and (optionally) validator functions in C, with a predefined API. These functions are compiled and registered with the Greenplum Database. For an example custom protocol, see Example Custom Data Access Protocol.

    2. After writing and compiling the read and write functions into a shared object (.so), declare a database function that points to the .so file and function names.

      The format of the optional validator function is:

      1. AS '$libdir/gpextprotocol.so', 'myprot_validate'
    3. Create a protocol that accesses these functions. Validatorfunc is optional.

    4. Grant access to any other users, as necessary.

    Declare custom protocols with the SQL command CREATE TRUSTED PROTOCOL, then use the GRANT command to grant access to your users. For example:

    • Allow a user to create a writable external table with a trusted protocol

    Parent topic: