mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-28 01:30:29 +08:00
Allow owner change of a data node
Allow previously blocked `ALTER SERVER OWNER TO` operation on a data node foreign server. Fix #3617
This commit is contained in:
parent
fffd6c2350
commit
35bd83d083
@ -412,22 +412,6 @@ process_alter_foreign_server(ProcessUtilityArgs *args)
|
||||
return DDL_CONTINUE;
|
||||
}
|
||||
|
||||
static DDLResult
|
||||
process_alter_owner(ProcessUtilityArgs *args)
|
||||
{
|
||||
AlterOwnerStmt *stmt = (AlterOwnerStmt *) args->parsetree;
|
||||
|
||||
if ((stmt->objectType == OBJECT_FOREIGN_SERVER) &&
|
||||
block_on_foreign_server(strVal(stmt->object)))
|
||||
{
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("alter owner not supported on a TimescaleDB data node")));
|
||||
}
|
||||
|
||||
return DDL_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
process_altertableschema(ProcessUtilityArgs *args)
|
||||
{
|
||||
@ -3773,9 +3757,6 @@ process_ddl_command_start(ProcessUtilityArgs *args)
|
||||
case T_AlterForeignServerStmt:
|
||||
handler = process_alter_foreign_server;
|
||||
break;
|
||||
case T_AlterOwnerStmt:
|
||||
handler = process_alter_owner;
|
||||
break;
|
||||
case T_CreateForeignServerStmt:
|
||||
handler = process_create_foreign_server_start;
|
||||
break;
|
||||
@ -3846,7 +3827,7 @@ process_ddl_command_start(ProcessUtilityArgs *args)
|
||||
}
|
||||
|
||||
if (handler == NULL)
|
||||
return false;
|
||||
return DDL_CONTINUE;
|
||||
|
||||
if (check_read_only)
|
||||
#if PG13_GE
|
||||
|
@ -82,9 +82,9 @@ ALTER SERVER data_node_1 OPTIONS (DROP sslmode);
|
||||
ERROR: alter server not supported on a TimescaleDB data node
|
||||
ALTER SERVER data_node_1 RENAME TO data_node_k;
|
||||
ERROR: rename not supported on a TimescaleDB data node
|
||||
ALTER SERVER data_node_1 OWNER TO CURRENT_USER;
|
||||
ERROR: alter owner not supported on a TimescaleDB data node
|
||||
\set ON_ERROR_STOP 1
|
||||
-- Make sure changing server owner is allowed
|
||||
ALTER SERVER data_node_1 OWNER TO CURRENT_USER;
|
||||
-- List foreign data nodes
|
||||
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
|
||||
node_name | options
|
||||
|
@ -55,15 +55,16 @@ SELECT * FROM add_data_node('data_node_2', host => 'localhost', database => :'DN
|
||||
|
||||
SELECT * FROM add_data_node('data_node_3', host => 'localhost', database => :'DN_DBNAME_3');
|
||||
|
||||
|
||||
-- Test altering server command is blocked
|
||||
\set ON_ERROR_STOP 0
|
||||
ALTER SERVER data_node_1 OPTIONS (SET fdw_startup_cost '110.0');
|
||||
ALTER SERVER data_node_1 OPTIONS (DROP sslmode);
|
||||
ALTER SERVER data_node_1 RENAME TO data_node_k;
|
||||
ALTER SERVER data_node_1 OWNER TO CURRENT_USER;
|
||||
\set ON_ERROR_STOP 1
|
||||
|
||||
-- Make sure changing server owner is allowed
|
||||
ALTER SERVER data_node_1 OWNER TO CURRENT_USER;
|
||||
|
||||
-- List foreign data nodes
|
||||
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user