Move citus_internal_delete_tenant_schema

pull/7473/head
eaydingol 2024-01-31 13:27:10 +00:00
parent 6ddb6d86d1
commit 922b943483
9 changed files with 36 additions and 6 deletions

View File

@ -4241,7 +4241,7 @@ TenantSchemaDeleteCommand(char *schemaName)
{ {
StringInfo command = makeStringInfo(); StringInfo command = makeStringInfo();
appendStringInfo(command, appendStringInfo(command,
"SELECT pg_catalog.citus_internal_delete_tenant_schema(%s)", "SELECT citus_internal.delete_tenant_schema(%s)",
RemoteSchemaIdExpressionByName(schemaName)); RemoteSchemaIdExpressionByName(schemaName));
return command->data; return command->data;

View File

@ -37,3 +37,4 @@ REVOKE ALL ON FUNCTION citus_internal.start_management_transaction FROM PUBLIC;
#include "udfs/citus_internal_delete_partition_metadata/12.2-1.sql" #include "udfs/citus_internal_delete_partition_metadata/12.2-1.sql"
#include "udfs/citus_internal_delete_placement_metadata/12.2-1.sql" #include "udfs/citus_internal_delete_placement_metadata/12.2-1.sql"
#include "udfs/citus_internal_delete_shard_metadata/12.2-1.sql" #include "udfs/citus_internal_delete_shard_metadata/12.2-1.sql"
#include "udfs/citus_internal_delete_tenant_schema/12.2-1.sql"

View File

@ -33,4 +33,5 @@ DROP FUNCTION citus_internal.adjust_local_clock_to_remote(pg_catalog.cluster_clo
DROP FUNCTION citus_internal.delete_colocation_metadata(int); DROP FUNCTION citus_internal.delete_colocation_metadata(int);
DROP FUNCTION citus_internal.delete_partition_metadata(regclass); DROP FUNCTION citus_internal.delete_partition_metadata(regclass);
DROP FUNCTION citus_internal.delete_placement_metadata(bigint); DROP FUNCTION citus_internal.delete_placement_metadata(bigint);
DROP FUNCTION citus_internal.delete_shard_metadata(bigint); DROP FUNCTION citus_internal.delete_shard_metadata(bigint);
DROP FUNCTION citus_internal.delete_tenant_schema(oid);

View File

@ -0,0 +1,17 @@
CREATE OR REPLACE FUNCTION citus_internal.delete_tenant_schema(schema_id Oid)
RETURNS void
LANGUAGE C
VOLATILE
AS 'MODULE_PATHNAME', $$citus_internal_delete_tenant_schema$$;
COMMENT ON FUNCTION citus_internal.delete_tenant_schema(Oid) IS
'delete given tenant schema from pg_dist_schema';
CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_delete_tenant_schema(schema_id Oid)
RETURNS void
LANGUAGE C
VOLATILE
AS 'MODULE_PATHNAME';
COMMENT ON FUNCTION pg_catalog.citus_internal_delete_tenant_schema(Oid) IS
'delete given tenant schema from pg_dist_schema';

View File

@ -1,3 +1,12 @@
CREATE OR REPLACE FUNCTION citus_internal.delete_tenant_schema(schema_id Oid)
RETURNS void
LANGUAGE C
VOLATILE
AS 'MODULE_PATHNAME', $$citus_internal_delete_tenant_schema$$;
COMMENT ON FUNCTION citus_internal.delete_tenant_schema(Oid) IS
'delete given tenant schema from pg_dist_schema';
CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_delete_tenant_schema(schema_id Oid) CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_delete_tenant_schema(schema_id Oid)
RETURNS void RETURNS void
LANGUAGE C LANGUAGE C

View File

@ -1436,10 +1436,11 @@ SELECT * FROM multi_extension.print_extension_changes();
| function citus_internal.delete_partition_metadata(regclass) void | function citus_internal.delete_partition_metadata(regclass) void
| function citus_internal.delete_placement_metadata(bigint) void | function citus_internal.delete_placement_metadata(bigint) void
| function citus_internal.delete_shard_metadata(bigint) void | function citus_internal.delete_shard_metadata(bigint) void
| function citus_internal.delete_tenant_schema(oid) void
| function citus_internal.execute_command_on_remote_nodes_as_user(text,text) void | function citus_internal.execute_command_on_remote_nodes_as_user(text,text) void
| function citus_internal.mark_object_distributed(oid,text,oid,text) void | function citus_internal.mark_object_distributed(oid,text,oid,text) void
| function citus_internal.start_management_transaction(xid8) void | function citus_internal.start_management_transaction(xid8) void
(17 rows) (18 rows)
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff; DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
-- show running version -- show running version

View File

@ -17,7 +17,7 @@ SELECT citus_internal.add_tenant_schema(NULL, 1);
ERROR: schema_id cannot be NULL ERROR: schema_id cannot be NULL
SELECT citus_internal.add_tenant_schema(1, NULL); SELECT citus_internal.add_tenant_schema(1, NULL);
ERROR: colocation_id cannot be NULL ERROR: colocation_id cannot be NULL
SELECT citus_internal_delete_tenant_schema(NULL); SELECT citus_internal.delete_tenant_schema(NULL);
ERROR: schema_id cannot be NULL ERROR: schema_id cannot be NULL
SELECT citus_internal_unregister_tenant_schema_globally(1, NULL); SELECT citus_internal_unregister_tenant_schema_globally(1, NULL);
ERROR: schema_name cannot be NULL ERROR: schema_name cannot be NULL

View File

@ -70,6 +70,7 @@ ORDER BY 1;
function citus_internal.delete_partition_metadata(regclass) function citus_internal.delete_partition_metadata(regclass)
function citus_internal.delete_placement_metadata(bigint) function citus_internal.delete_placement_metadata(bigint)
function citus_internal.delete_shard_metadata(bigint) function citus_internal.delete_shard_metadata(bigint)
function citus_internal.delete_tenant_schema(oid)
function citus_internal.execute_command_on_remote_nodes_as_user(text,text) function citus_internal.execute_command_on_remote_nodes_as_user(text,text)
function citus_internal.find_groupid_for_node(text,integer) function citus_internal.find_groupid_for_node(text,integer)
function citus_internal.mark_object_distributed(oid,text,oid,text) function citus_internal.mark_object_distributed(oid,text,oid,text)
@ -360,5 +361,5 @@ ORDER BY 1;
view citus_stat_tenants_local view citus_stat_tenants_local
view pg_dist_shard_placement view pg_dist_shard_placement
view time_partitions view time_partitions
(350 rows) (351 rows)

View File

@ -14,7 +14,7 @@ SET client_min_messages TO NOTICE;
-- fail on NULL input. -- fail on NULL input.
SELECT citus_internal.add_tenant_schema(NULL, 1); SELECT citus_internal.add_tenant_schema(NULL, 1);
SELECT citus_internal.add_tenant_schema(1, NULL); SELECT citus_internal.add_tenant_schema(1, NULL);
SELECT citus_internal_delete_tenant_schema(NULL); SELECT citus_internal.delete_tenant_schema(NULL);
SELECT citus_internal_unregister_tenant_schema_globally(1, NULL); SELECT citus_internal_unregister_tenant_schema_globally(1, NULL);
SELECT citus_internal_unregister_tenant_schema_globally(NULL, 'text'); SELECT citus_internal_unregister_tenant_schema_globally(NULL, 'text');