mirror of https://github.com/citusdata/citus.git
Adds same access method check
parent
e1376ca106
commit
434f5af030
|
@ -455,6 +455,14 @@ AlterTableSetAccessMethod(TableConversionParameters *params)
|
|||
params->conversionType = ALTER_TABLE_SET_ACCESS_METHOD;
|
||||
params->shardCountIsNull = true;
|
||||
TableConversionState *con = CreateTableConversion(params);
|
||||
|
||||
if (strcmp(con->originalAccessMethod, con->accessMethod) == 0)
|
||||
{
|
||||
ereport(ERROR, (errmsg("the access method of %s is already %s",
|
||||
generate_qualified_relation_name(con->relationId),
|
||||
con->accessMethod)));
|
||||
}
|
||||
|
||||
return ConvertTable(con);
|
||||
}
|
||||
|
||||
|
|
|
@ -455,6 +455,10 @@ NOTICE: Renaming the new table to alter_table_set_access_method.test_fk_p1
|
|||
ERROR: Foreign keys and AFTER ROW triggers are not supported for columnar tables
|
||||
HINT: Consider an AFTER STATEMENT trigger instead.
|
||||
CONTEXT: SQL statement "ALTER TABLE alter_table_set_access_method.test_fk_p ATTACH PARTITION alter_table_set_access_method.test_fk_p1 FOR VALUES FROM (10) TO (20);"
|
||||
-- test changing into same access method
|
||||
CREATE TABLE same_access_method (a INT);
|
||||
SELECT alter_table_set_access_method('same_access_method', 'heap');
|
||||
ERROR: the access method of alter_table_set_access_method.same_access_method is already heap
|
||||
SET client_min_messages TO WARNING;
|
||||
DROP SCHEMA alter_table_set_access_method CASCADE;
|
||||
SELECT 1 FROM master_remove_node('localhost', :master_port);
|
||||
|
|
|
@ -139,6 +139,10 @@ create table test_fk_p0 partition of test_fk_p for values from (0) to (10);
|
|||
create table test_fk_p1 partition of test_fk_p for values from (10) to (20);
|
||||
select alter_table_set_access_method('test_fk_p1', 'columnar');
|
||||
|
||||
-- test changing into same access method
|
||||
CREATE TABLE same_access_method (a INT);
|
||||
SELECT alter_table_set_access_method('same_access_method', 'heap');
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
DROP SCHEMA alter_table_set_access_method CASCADE;
|
||||
SELECT 1 FROM master_remove_node('localhost', :master_port);
|
||||
|
|
Loading…
Reference in New Issue