pg-extend

Crates.iopg-extend
lib.rspg-extend
version0.2.1
sourcesrc
created_at2018-12-27 16:02:56.86861
updated_at2018-12-28 00:57:48.633506
descriptionA library for extending Postgres with Rust.
homepage
repositoryhttps://github.com/bluejekyll/pg-extend
max_upload_size
id104062
size15,667
Benjamin Fry (bluejekyll)

documentation

https://docs.rs/pg-extend

README

Rust based postgres extension

The main things provided by this crate are some macros that help with writing Postgres extensions in Rust.

The objective (not all these are yet implemented):

  • Automatic type conversions, see PgDatum and TryFromPgDatum to Into<PgDatum>
  • pg_magic macro for declaring libraries as Postgres extensions
  • pg_extern attribute for wrapping Rust functions in Postgres C style definitions
  • panic handlers for conversion into Postgres errors
  • allocator that uses Postgres palloc allocator and pfree
  • tbd integrate postgres error logs with log
  • tbd support all Datum types
  • tbd support table like returns and manipulation
  • tbd generators for the psql scripts to load functions

Building

First install Postgres. Once installed, this environment variable is required:

PG_INCLUDE_PATH=[/path/to/postgres]/include/server # e.g. /usr/local/pgsql/include/server

This environment variable is also required for the dynamic libraries to compile:

RUSTFLAGS="-C link-arg=-undefineddynamic_lookup"

This informs the linker that some of the symbols for postgres won't be available until runtime on the dynamic library load.

Examples

Commit count: 171

cargo fmt