|
37 | 37 | */ |
38 | 38 |
|
39 | 39 |
|
40 | | -/* |
41 | | - * CatalogIndexInsert is the copy of static prototype having the same name from |
42 | | - * src/backend/catalog/indexing.c |
43 | | - */ |
44 | | -#if PG_VERSION_NUM >= 100000 |
45 | | -#include "catalog/index.h" |
46 | | -void |
47 | | -CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple) |
48 | | -{ |
49 | | - int i; |
50 | | - int numIndexes; |
51 | | - RelationPtr relationDescs; |
52 | | - Relation heapRelation; |
53 | | - TupleTableSlot *slot; |
54 | | - IndexInfo **indexInfoArray; |
55 | | - Datum values[INDEX_MAX_KEYS]; |
56 | | - bool isnull[INDEX_MAX_KEYS]; |
57 | | - |
58 | | - /* HOT update does not require index inserts */ |
59 | | - if (HeapTupleIsHeapOnly(heapTuple)) |
60 | | - return; |
61 | | - |
62 | | - /* |
63 | | - * Get information from the state structure. Fall out if nothing to do. |
64 | | - */ |
65 | | - numIndexes = indstate->ri_NumIndices; |
66 | | - if (numIndexes == 0) |
67 | | - return; |
68 | | - relationDescs = indstate->ri_IndexRelationDescs; |
69 | | - indexInfoArray = indstate->ri_IndexRelationInfo; |
70 | | - heapRelation = indstate->ri_RelationDesc; |
71 | | - |
72 | | - /* Need a slot to hold the tuple being examined */ |
73 | | - slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation)); |
74 | | - ExecStoreTuple(heapTuple, slot, InvalidBuffer, false); |
75 | | - |
76 | | - /* |
77 | | - * for each index, form and insert the index tuple |
78 | | - */ |
79 | | - for (i = 0; i < numIndexes; i++) |
80 | | - { |
81 | | - IndexInfo *indexInfo; |
82 | | - |
83 | | - indexInfo = indexInfoArray[i]; |
84 | | - |
85 | | - /* If the index is marked as read-only, ignore it */ |
86 | | - if (!indexInfo->ii_ReadyForInserts) |
87 | | - continue; |
88 | | - |
89 | | - /* |
90 | | - * Expressional and partial indexes on system catalogs are not |
91 | | - * supported, nor exclusion constraints, nor deferred uniqueness |
92 | | - */ |
93 | | - Assert(indexInfo->ii_Expressions == NIL); |
94 | | - Assert(indexInfo->ii_Predicate == NIL); |
95 | | - Assert(indexInfo->ii_ExclusionOps == NULL); |
96 | | - Assert(relationDescs[i]->rd_index->indimmediate); |
97 | | - |
98 | | - /* |
99 | | - * FormIndexDatum fills in its values and isnull parameters with the |
100 | | - * appropriate values for the column(s) of the index. |
101 | | - */ |
102 | | - FormIndexDatum(indexInfo, |
103 | | - slot, |
104 | | - NULL, /* no expression eval to do */ |
105 | | - values, |
106 | | - isnull); |
107 | | - |
108 | | - /* |
109 | | - * The index AM does the rest. |
110 | | - */ |
111 | | - index_insert(relationDescs[i], /* index relation */ |
112 | | - values, /* array of index Datums */ |
113 | | - isnull, /* is-null flags */ |
114 | | - &(heapTuple->t_self), /* tid of heap tuple */ |
115 | | - heapRelation, |
116 | | - relationDescs[i]->rd_index->indisunique ? |
117 | | - UNIQUE_CHECK_YES : UNIQUE_CHECK_NO, |
118 | | - indexInfo); |
119 | | - } |
120 | | - |
121 | | - ExecDropSingleTupleTableSlot(slot); |
122 | | -} |
123 | | -#endif |
124 | | - |
125 | | - |
126 | 40 | /* |
127 | 41 | * create_plain_partial_paths |
128 | 42 | * Build partial access paths for parallel scan of a plain relation |
@@ -790,48 +704,3 @@ set_append_rel_size_compat(PlannerInfo *root, RelOptInfo *rel, Index rti) |
790 | 704 |
|
791 | 705 | rel->tuples = parent_rows; |
792 | 706 | } |
793 | | - |
794 | | -/* |
795 | | - * Construct the sequence of utility statements to create a new partition |
796 | | - */ |
797 | | -List * |
798 | | -init_createstmts_for_partition(RangeVar *parent_rv, |
799 | | - RangeVar *partition_rv, |
800 | | - char *tablespace) |
801 | | -{ |
802 | | - TableLikeClause like_clause; |
803 | | - CreateStmt create_stmt; |
804 | | - List *result; |
805 | | - |
806 | | - /* Initialize TableLikeClause structure */ |
807 | | - NodeSetTag(&like_clause, T_TableLikeClause); |
808 | | - like_clause.relation = copyObject(parent_rv); |
809 | | - like_clause.options = CREATE_TABLE_LIKE_DEFAULTS | |
810 | | - CREATE_TABLE_LIKE_INDEXES | |
811 | | - CREATE_TABLE_LIKE_STORAGE; |
812 | | - |
813 | | - /* Initialize CreateStmt structure */ |
814 | | - NodeSetTag(&create_stmt, T_CreateStmt); |
815 | | - create_stmt.relation = copyObject(partition_rv); |
816 | | - create_stmt.tableElts = list_make1(copyObject(&like_clause)); |
817 | | - create_stmt.inhRelations = list_make1(copyObject(parent_rv)); |
818 | | - create_stmt.ofTypename = NULL; |
819 | | - create_stmt.constraints = NIL; |
820 | | - create_stmt.options = NIL; |
821 | | - create_stmt.oncommit = ONCOMMIT_NOOP; |
822 | | - create_stmt.tablespacename = tablespace; |
823 | | - create_stmt.if_not_exists = false; |
824 | | - |
825 | | -#if defined(PGPRO_EE) && PG_VERSION_NUM >= 90600 |
826 | | - create_stmt.partition_info = NULL; |
827 | | -#endif |
828 | | - |
829 | | -#if PG_VERSION_NUM >= 100000 |
830 | | - create_stmt.partbound = NULL; |
831 | | - create_stmt.partspec = NULL; |
832 | | -#endif |
833 | | - |
834 | | - result = transformCreateStmt(&create_stmt, NULL); |
835 | | - |
836 | | - return result; |
837 | | -} |
0 commit comments