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_am.h"
#include "catalog/pg_depend.h" #include "catalog/pg_depend.h"
#include "catalog/pg_rewrite_d.h" #include "catalog/pg_rewrite_d.h"
#include "commands/defrem.h"
#include "commands/comment.h" #include "commands/comment.h"
#include "commands/defrem.h"
#include "executor/spi.h" #include "executor/spi.h"
#include "nodes/pg_list.h" #include "nodes/pg_list.h"
#include "utils/builtins.h" #include "utils/builtins.h"
@ -1779,11 +1779,13 @@ CreateMaterializedViewDDLCommand(Oid matViewOid)
return query->data; 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 static void
MigrateColumnComments(Oid sourceId, Oid targetId){ MigrateColumnComments(Oid sourceId, Oid targetId)
{
Relation relation = relation_open(sourceId, AccessShareLock); Relation relation = relation_open(sourceId, AccessShareLock);
TupleDesc tupleDesc = RelationGetDescr(relation); TupleDesc tupleDesc = RelationGetDescr(relation);
for (int attrNum = 0; attrNum < tupleDesc->natts; attrNum++) for (int attrNum = 0; attrNum < tupleDesc->natts; attrNum++)
@ -1798,17 +1800,21 @@ MigrateColumnComments(Oid sourceId, Oid targetId){
relation_close(relation, AccessShareLock); relation_close(relation, AccessShareLock);
} }
/* /*
* MigrateTableComment migrates the comment of the source distributed table to the target undistributed table. * MigrateTableComment migrates the comment of the source distributed table to the target undistributed table.
*/ */
static void static void
MigrateTableComment(Oid sourceId, Oid targetId){ MigrateTableComment(Oid sourceId, Oid targetId)
{
char *comment = GetComment(sourceId, RelationRelationId, 0); char *comment = GetComment(sourceId, RelationRelationId, 0);
if(comment != NULL) { if (comment != NULL)
{
CreateComments(targetId, RelationRelationId, 0, comment); CreateComments(targetId, RelationRelationId, 0, comment);
} }
} }
/* /*
* ReplaceTable replaces the source table with the target table. * ReplaceTable replaces the source table with the target table.
* It moves all the rows of the source table to target table with INSERT SELECT. * 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 (!PartitionedTable(sourceId) && !IsForeignTable(sourceId))
{ {
if (!suppressNoticeMessages) if (!suppressNoticeMessages)
{ {
ereport(NOTICE, (errmsg("moving the data of %s", qualifiedSourceName))); 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); ExecuteQueryViaSPI(query->data, SPI_OK_UTILITY);
} }
/* /*
* HasAnyGeneratedStoredColumns decides if relation has any columns that we * HasAnyGeneratedStoredColumns decides if relation has any columns that we
* might need to copy the data of when replacing table. * might need to copy the data of when replacing table.