From 090056580b61054fa3c62601514d66f9fda24477 Mon Sep 17 00:00:00 2001 From: MikeRotchip Date: Tue, 8 Oct 2024 19:04:26 +0200 Subject: [PATCH] only use current schema query on pg13 --- src/fdw/trigger.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fdw/trigger.rs b/src/fdw/trigger.rs index c9a07ff5..ec4b6588 100644 --- a/src/fdw/trigger.rs +++ b/src/fdw/trigger.rs @@ -94,6 +94,7 @@ unsafe fn auto_create_schema_impl(fcinfo: pg_sys::FunctionCallInfo) -> Result<() // Get relation name, oid, etc. that triggered the event let relation = create_stmt.relation; + #[cfg(feature = "pg13")] // Fetch the current schema name if the pointer to it is null // This pointer is null in pg13 when the user doesn't specify the schema in the CREATE FOREIGN TABLE statement let schema_name = match ((*relation).schemaname as *const c_char).is_null() { @@ -108,6 +109,9 @@ unsafe fn auto_create_schema_impl(fcinfo: pg_sys::FunctionCallInfo) -> Result<() false => CStr::from_ptr((*relation).schemaname).to_str()?, }; + #[cfg(not(feature = "pg13"))] + let schema_name = CStr::from_ptr((*relation).schemaname).to_str()?; + let table_name = CStr::from_ptr((*relation).relname).to_str()?; let oid = pg_sys::RangeVarGetRelidExtended( relation,