mirror of https://github.com/citusdata/citus.git
Code formatting cleanup
parent
4e525fc170
commit
45fca50598
|
@ -34,8 +34,8 @@
|
|||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_depend.h"
|
||||
#include "catalog/pg_rewrite_d.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/comment.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "executor/spi.h"
|
||||
#include "nodes/pg_list.h"
|
||||
#include "utils/builtins.h"
|
||||
|
@ -1779,11 +1779,13 @@ CreateMaterializedViewDDLCommand(Oid matViewOid)
|
|||
return query->data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MigrateColumnComments migrates distributed table column comments to the target undistributed table columns.
|
||||
*/
|
||||
* MigrateColumnComments migrates distributed table column comments to the target undistributed table columns.
|
||||
*/
|
||||
static void
|
||||
MigrateColumnComments(Oid sourceId, Oid targetId){
|
||||
MigrateColumnComments(Oid sourceId, Oid targetId)
|
||||
{
|
||||
Relation relation = relation_open(sourceId, AccessShareLock);
|
||||
TupleDesc tupleDesc = RelationGetDescr(relation);
|
||||
for (int attrNum = 0; attrNum < tupleDesc->natts; attrNum++)
|
||||
|
@ -1791,24 +1793,28 @@ MigrateColumnComments(Oid sourceId, Oid targetId){
|
|||
Form_pg_attribute attr = TupleDescAttr(tupleDesc, attrNum);
|
||||
if (!attr->attisdropped)
|
||||
{
|
||||
char *columnComment = GetComment(sourceId, RelationRelationId ,attrNum + 1);
|
||||
char *columnComment = GetComment(sourceId, RelationRelationId, attrNum + 1);
|
||||
CreateComments(targetId, RelationRelationId, attrNum + 1, columnComment);
|
||||
}
|
||||
}
|
||||
relation_close(relation, AccessShareLock);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MigrateTableComment migrates the comment of the source distributed table to the target undistributed table.
|
||||
*/
|
||||
*/
|
||||
static void
|
||||
MigrateTableComment(Oid sourceId, Oid targetId){
|
||||
MigrateTableComment(Oid sourceId, Oid targetId)
|
||||
{
|
||||
char *comment = GetComment(sourceId, RelationRelationId, 0);
|
||||
if(comment != NULL) {
|
||||
if (comment != NULL)
|
||||
{
|
||||
CreateComments(targetId, RelationRelationId, 0, comment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ReplaceTable replaces the source table with the target table.
|
||||
* It moves all the rows of the source table to target table with INSERT SELECT.
|
||||
|
@ -1828,7 +1834,6 @@ ReplaceTable(Oid sourceId, Oid targetId, List *justBeforeDropCommands,
|
|||
|
||||
if (!PartitionedTable(sourceId) && !IsForeignTable(sourceId))
|
||||
{
|
||||
|
||||
if (!suppressNoticeMessages)
|
||||
{
|
||||
ereport(NOTICE, (errmsg("moving the data of %s", qualifiedSourceName)));
|
||||
|
@ -1933,6 +1938,7 @@ ReplaceTable(Oid sourceId, Oid targetId, List *justBeforeDropCommands,
|
|||
ExecuteQueryViaSPI(query->data, SPI_OK_UTILITY);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* HasAnyGeneratedStoredColumns decides if relation has any columns that we
|
||||
* might need to copy the data of when replacing table.
|
||||
|
|
|
@ -4,4 +4,4 @@ test: comment_migration_table_joined_tables
|
|||
test: comment_migration_table_joined_tables_FK
|
||||
test: comment_migration_column
|
||||
test: comment_migration_column_joined_tables
|
||||
test: comment_migration_column_joined_tables_FK
|
||||
test: comment_migration_column_joined_tables_FK
|
||||
|
|
|
@ -144,4 +144,4 @@ test: comment_migration_table_joined_tables
|
|||
test: comment_migration_table_joined_tables_FK
|
||||
test: comment_migration_column
|
||||
test: comment_migration_column_joined_tables
|
||||
test: comment_migration_column_joined_tables_FK
|
||||
test: comment_migration_column_joined_tables_FK
|
||||
|
|
|
@ -30,4 +30,4 @@ SELECT create_distributed_table('comment_migration_column.table_1', 'id');
|
|||
select col_description('comment_migration_column.table_1'::regclass,1), col_description('comment_migration_column.table_1'::regclass,2), col_description('comment_migration_column.table_1'::regclass,3), col_description('comment_migration_column.table_1'::regclass,4), col_description('comment_migration_column.table_1'::regclass,5);
|
||||
|
||||
DROP TABLE comment_migration_column.table_1;
|
||||
DROP SCHEMA comment_migration_column;
|
||||
DROP SCHEMA comment_migration_column;
|
||||
|
|
|
@ -51,4 +51,4 @@ select col_description('comment_migration_column.table_2'::regclass,1), col_desc
|
|||
|
||||
DROP TABLE comment_migration_column.table_2;
|
||||
DROP TABLE comment_migration_column.table_1;
|
||||
DROP SCHEMA comment_migration_column;
|
||||
DROP SCHEMA comment_migration_column;
|
||||
|
|
|
@ -53,4 +53,4 @@ select col_description('comment_migration_column.table_2'::regclass,1), col_desc
|
|||
|
||||
DROP TABLE comment_migration_column.table_2;
|
||||
DROP TABLE comment_migration_column.table_1;
|
||||
DROP SCHEMA comment_migration_column;
|
||||
DROP SCHEMA comment_migration_column;
|
||||
|
|
|
@ -14,16 +14,16 @@ CREATE TABLE comment_migration_table.table_1
|
|||
SET citus.shard_replication_factor = 1;
|
||||
|
||||
comment on table comment_migration_table.table_1 is 'Table 1';
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
|
||||
SELECT create_distributed_table('comment_migration_table.table_1', 'id');
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
|
||||
select undistribute_table('comment_migration_table.table_1');
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
|
||||
SELECT create_distributed_table('comment_migration_table.table_1', 'id');
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
select obj_description('comment_migration_table.table_1'::regclass);
|
||||
|
||||
DROP TABLE comment_migration_table.table_1;
|
||||
DROP SCHEMA comment_migration_table;
|
||||
DROP SCHEMA comment_migration_table;
|
||||
|
|
|
@ -46,4 +46,4 @@ select obj_description('comment_migration_table.table_2'::regclass);
|
|||
|
||||
DROP TABLE comment_migration_table.table_2;
|
||||
DROP TABLE comment_migration_table.table_1;
|
||||
DROP SCHEMA comment_migration_table;
|
||||
DROP SCHEMA comment_migration_table;
|
||||
|
|
|
@ -48,4 +48,4 @@ select obj_description('comment_migration_table.table_2'::regclass);
|
|||
|
||||
DROP TABLE comment_migration_table.table_2;
|
||||
DROP TABLE comment_migration_table.table_1;
|
||||
DROP SCHEMA comment_migration_table;
|
||||
DROP SCHEMA comment_migration_table;
|
||||
|
|
Loading…
Reference in New Issue