Rename ExtractColumnsOwningSequences

pull/4613/head
Onur Tirtir 2021-02-02 16:02:19 +03:00
parent 912d829757
commit 93c3f30024
4 changed files with 13 additions and 11 deletions

View File

@ -893,8 +893,8 @@ DropAndMoveDefaultSequenceOwnerships(Oid sourceRelationId, Oid targetRelationId)
{ {
List *columnNameList = NIL; List *columnNameList = NIL;
List *ownedSequenceIdList = NIL; List *ownedSequenceIdList = NIL;
ExtractColumnsOwningSequences(sourceRelationId, &columnNameList, ExtractDefaultColumnsAndOwnedSequences(sourceRelationId, &columnNameList,
&ownedSequenceIdList); &ownedSequenceIdList);
ListCell *columnNameCell = NULL; ListCell *columnNameCell = NULL;
ListCell *ownedSequenceIdCell = NULL; ListCell *ownedSequenceIdCell = NULL;

View File

@ -151,13 +151,14 @@ OptionsSpecifyOwnedBy(List *optionList, Oid *ownedByTableId)
/* /*
* ExtractColumnsOwningSequences finds each column of relation with relationId * ExtractDefaultColumnsAndOwnedSequences finds each column of relation with
* defaulting to an owned sequence. Then, appends the column name and id of the * relationId that has a DEFAULT expression and each sequence owned by such
* owned sequence -that the column defaults- to the lists passed as NIL initially. * columns (if any). Then, appends the column name and id of the owned sequence
* -that the column defaults- to the lists passed as NIL initially.
*/ */
void void
ExtractColumnsOwningSequences(Oid relationId, List **columnNameList, ExtractDefaultColumnsAndOwnedSequences(Oid relationId, List **columnNameList,
List **ownedSequenceIdList) List **ownedSequenceIdList)
{ {
Assert(*columnNameList == NIL && *ownedSequenceIdList == NIL); Assert(*columnNameList == NIL && *ownedSequenceIdList == NIL);

View File

@ -1131,7 +1131,7 @@ SequenceDependencyCommandList(Oid relationId)
List *columnNameList = NIL; List *columnNameList = NIL;
List *sequenceIdList = NIL; List *sequenceIdList = NIL;
ExtractColumnsOwningSequences(relationId, &columnNameList, &sequenceIdList); ExtractDefaultColumnsAndOwnedSequences(relationId, &columnNameList, &sequenceIdList);
ListCell *columnNameCell = NULL; ListCell *columnNameCell = NULL;
ListCell *sequenceIdCell = NULL; ListCell *sequenceIdCell = NULL;
@ -1144,7 +1144,7 @@ SequenceDependencyCommandList(Oid relationId)
if (!OidIsValid(sequenceId)) if (!OidIsValid(sequenceId))
{ {
/* /*
* ExtractColumnsOwningSequences returns entries for all columns, * ExtractDefaultColumnsAndOwnedSequences returns entries for all columns,
* but with 0 sequence ID unless there is default nextval(..). * but with 0 sequence ID unless there is default nextval(..).
*/ */
continue; continue;

View File

@ -13,8 +13,9 @@
#include "nodes/pg_list.h" #include "nodes/pg_list.h"
extern void ExtractColumnsOwningSequences(Oid relationId, List **columnNameList, extern void ExtractDefaultColumnsAndOwnedSequences(Oid relationId,
List **ownedSequenceIdList); List **columnNameList,
List **ownedSequenceIdList);
#endif /* CITUS_SEQUENCE_H */ #endif /* CITUS_SEQUENCE_H */