Code formatting cleanup

pull/7635/head
EriksP 2024-06-21 13:56:43 +03:00
parent 4e525fc170
commit 45fca50598
9 changed files with 27 additions and 21 deletions

View File

@ -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.