* ATGetQueueEntry: find or create an entry in the ALTER TABLE work queue */
| 7748 | * ATGetQueueEntry: find or create an entry in the ALTER TABLE work queue |
| 7749 | */ |
| 7750 | static AlteredTableInfo * |
| 7751 | ATGetQueueEntry(List **wqueue, Relation rel) |
| 7752 | { |
| 7753 | Oid relid = RelationGetRelid(rel); |
| 7754 | AlteredTableInfo *tab; |
| 7755 | ListCell *ltab; |
| 7756 | |
| 7757 | foreach(ltab, *wqueue) |
| 7758 | { |
| 7759 | tab = (AlteredTableInfo *) lfirst(ltab); |
| 7760 | if (tab->relid == relid) |
| 7761 | return tab; |
| 7762 | } |
| 7763 | |
| 7764 | /* |
| 7765 | * Not there, so add it. Note that we make a copy of the relation's |
| 7766 | * existing descriptor before anything interesting can happen to it. |
| 7767 | */ |
| 7768 | tab = makeNode(AlteredTableInfo); |
| 7769 | tab->relid = relid; |
| 7770 | tab->rel = NULL; /* set later */ |
| 7771 | tab->relkind = rel->rd_rel->relkind; |
| 7772 | tab->oldDesc = CreateTupleDescCopyConstr(RelationGetDescr(rel)); |
| 7773 | tab->newAccessMethod = InvalidOid; |
| 7774 | tab->newTableSpace = InvalidOid; |
| 7775 | tab->newrelpersistence = RELPERSISTENCE_PERMANENT; |
| 7776 | tab->chgPersistence = false; |
| 7777 | |
| 7778 | *wqueue = lappend(*wqueue, tab); |
| 7779 | |
| 7780 | return tab; |
| 7781 | } |
| 7782 | |
| 7783 | /* |
| 7784 | * ATSimplePermissions |
no test coverage detected