From 3ad948163c7c5b3083ede0e94261aa74448cbf7c Mon Sep 17 00:00:00 2001
From: Jan Nidzwetzki <jan@timescale.com>
Date: Wed, 24 Apr 2024 09:44:34 +0200
Subject: [PATCH] Remove MN leftover create distributed hypertable

This commit removes an unused function that was used in MN setups to
create distributed hypertables.
---
 sql/updates/2.7.2--2.8.0.sql |  3 ++-
 src/hypertable.c             | 18 ------------------
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/sql/updates/2.7.2--2.8.0.sql b/sql/updates/2.7.2--2.8.0.sql
index 050a43c87..2c81aeecf 100644
--- a/sql/updates/2.7.2--2.8.0.sql
+++ b/sql/updates/2.7.2--2.8.0.sql
@@ -131,6 +131,7 @@ CREATE FUNCTION @extschema@.create_hypertable(
 ) RETURNS TABLE(hypertable_id INT, schema_name NAME, table_name NAME, created BOOL) AS '@MODULE_PATHNAME@', 'ts_hypertable_create' LANGUAGE C VOLATILE;
 
 -- change replication_factor to NULL by default
+-- create stub to not introduce shared library dependency
 CREATE FUNCTION @extschema@.create_distributed_hypertable(
     relation                REGCLASS,
     time_column_name        NAME,
@@ -148,4 +149,4 @@ CREATE FUNCTION @extschema@.create_distributed_hypertable(
     time_partitioning_func  REGPROC = NULL,
     replication_factor      INTEGER = NULL,
     data_nodes              NAME[] = NULL
-) RETURNS TABLE(hypertable_id INT, schema_name NAME, table_name NAME, created BOOL) AS '@MODULE_PATHNAME@', 'ts_hypertable_distributed_create' LANGUAGE C VOLATILE;
+) RETURNS TABLE(hypertable_id INT, schema_name NAME, table_name NAME, created BOOL) AS $$ SELECT NULL::int,NULL::name,NULL::name,NULL::bool; $$ LANGUAGE SQL VOLATILE;
diff --git a/src/hypertable.c b/src/hypertable.c
index 10524812d..38d64a3cf 100644
--- a/src/hypertable.c
+++ b/src/hypertable.c
@@ -1526,7 +1526,6 @@ create_hypertable_datum(FunctionCallInfo fcinfo, const Hypertable *ht, bool crea
 }
 
 TS_FUNCTION_INFO_V1(ts_hypertable_create);
-TS_FUNCTION_INFO_V1(ts_hypertable_distributed_create);
 TS_FUNCTION_INFO_V1(ts_hypertable_create_general);
 
 /*
@@ -1705,23 +1704,6 @@ ts_hypertable_create(PG_FUNCTION_ARGS)
 	return ts_hypertable_create_time_prev(fcinfo, false);
 }
 
-Datum
-ts_hypertable_distributed_create(PG_FUNCTION_ARGS)
-{
-#if PG16_GE
-	ereport(ERROR,
-			(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-			 errmsg("distributed hypertable is not supported"),
-			 errdetail("Multi-node is not supported anymore on PostgreSQL >= 16.")));
-#else
-	ereport(WARNING,
-			(errcode(ERRCODE_WARNING_DEPRECATED_FEATURE),
-			 errmsg("distributed hypertable is deprecated"),
-			 errdetail("Multi-node is deprecated and will be removed in future releases.")));
-#endif
-	return ts_hypertable_create_time_prev(fcinfo, true);
-}
-
 static Oid
 get_sizing_func_oid()
 {