From f140ba87cb9f46abbd05762fee21632d72235ad2 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Wed, 9 Oct 2019 23:56:29 +0300 Subject: [PATCH] Disable FDW support on Postgres 11+ (see #49); created new feature flag Unfortunately, FDW examples and tests have to be disabled entirely, because 'examples/fdw' cannot depend on 'pg-extend' crate features. --- Cargo.lock | 16 ---------------- Cargo.toml | 7 ++++--- integration-tests/tests/fdw.rs | 3 +++ pg-extend/Cargo.toml | 7 ++++--- pg-extend/src/pg_fdw.rs | 7 +++++++ 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08d5575d..d147bba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -459,22 +459,6 @@ name = "fallible-iterator" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "fdw" -version = "0.1.0" -dependencies = [ - "pg-extend 0.2.1", - "pg-extern-attr 0.2.2", -] - -[[package]] -name = "fdw-rw" -version = "0.1.0" -dependencies = [ - "pg-extend 0.2.1", - "pg-extern-attr 0.2.2", -] - [[package]] name = "filetime" version = "0.2.6" diff --git a/Cargo.toml b/Cargo.toml index aaa2ddf2..b35816db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,9 +5,10 @@ debug = true members = [ "pg-extend", "pg-extern-attr", - "examples/adding", - "examples/fdw", - "examples/fdw-rw", + "examples/adding", +# Examples disabled because FDW support broken with PostgreSQL 11+. See https://github.com/bluejekyll/pg-extend-rs/issues/49 +# "examples/fdw", +# "examples/fdw-rw", "examples/logging", "examples/memory_context", "examples/nullable", diff --git a/integration-tests/tests/fdw.rs b/integration-tests/tests/fdw.rs index dee645fb..db4ab726 100644 --- a/integration-tests/tests/fdw.rs +++ b/integration-tests/tests/fdw.rs @@ -5,6 +5,9 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. +// FDW tests disabled because it's broken with PostgreSQL 11+. +#![cfg(fdw_is_broken)] + extern crate integration_tests; use integration_tests::*; diff --git a/pg-extend/Cargo.toml b/pg-extend/Cargo.toml index 938cb638..8d93e710 100644 --- a/pg-extend/Cargo.toml +++ b/pg-extend/Cargo.toml @@ -17,9 +17,10 @@ license = "MIT/Apache-2.0" build = "build.rs" [features] -default = ["postgres-10"] -postgres-9 = [] -postgres-10 = [] +default = ["postgres-11", "fdw"] +fdw = [] +postgres-9 = ["fdw"] +postgres-10 = ["fdw"] postgres-11 = [] [dependencies] diff --git a/pg-extend/src/pg_fdw.rs b/pg-extend/src/pg_fdw.rs index 7e7f4e89..58716e65 100644 --- a/pg-extend/src/pg_fdw.rs +++ b/pg-extend/src/pg_fdw.rs @@ -4,6 +4,13 @@ //! and https://bitbucket.org/adunstan/rotfang-fdw/src/ca21c2a2e5fa6e1424b61bf0170adb3ab4ae68e7/src/rotfang_fdw.c?at=master&fileviewer=file-view-default //! For use with `#[pg_foreignwrapper]` from pg-extend-attr +// FDW on PostgreSQL 11+ is not supported. :( +#![cfg(feature = "fdw")] + +// If anyone tries to enable "fdw" feature with newer Postgres, throw error. +#[cfg(feature = "postgres-11")] +compile_error!("pg-extend-rs does not support FDW on PostgreSQL 11 or newer. See https://github.com/bluejekyll/pg-extend-rs/issues/49"); + use std::boxed::Box; use std::collections::HashMap; use std::ffi::{CStr, CString};