mirror of https://github.com/citusdata/citus.git
Merge pull request #5054 from citusdata/base_for_enterprise_16_june
Get ready for Improve index backed constraint creation for online rebalancerpull/5042/head^2
commit
e56f5909c9
|
@ -799,28 +799,32 @@ GatherIndexAndConstraintDefinitionList(Form_pg_index indexForm, List **indexDDLE
|
|||
int indexFlags)
|
||||
{
|
||||
Oid indexId = indexForm->indexrelid;
|
||||
char *statementDef = NULL;
|
||||
|
||||
bool indexImpliedByConstraint = IndexImpliedByAConstraint(indexForm);
|
||||
|
||||
/* get the corresponding constraint or index statement */
|
||||
if (indexImpliedByConstraint)
|
||||
{
|
||||
Oid constraintId = get_index_constraint(indexId);
|
||||
Assert(constraintId != InvalidOid);
|
||||
if (indexFlags & INCLUDE_CREATE_CONSTRAINT_STATEMENTS)
|
||||
{
|
||||
Oid constraintId = get_index_constraint(indexId);
|
||||
Assert(constraintId != InvalidOid);
|
||||
|
||||
statementDef = pg_get_constraintdef_command(constraintId);
|
||||
/* include constraints backed by indexes only when explicitly asked */
|
||||
char *statementDef = pg_get_constraintdef_command(constraintId);
|
||||
*indexDDLEventList =
|
||||
lappend(*indexDDLEventList,
|
||||
makeTableDDLCommandString(statementDef));
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (indexFlags & INCLUDE_CREATE_INDEX_STATEMENTS)
|
||||
{
|
||||
statementDef = pg_get_indexdef_string(indexId);
|
||||
}
|
||||
|
||||
/* append found constraint or index definition to the list */
|
||||
if (indexFlags & INCLUDE_CREATE_INDEX_STATEMENTS)
|
||||
{
|
||||
*indexDDLEventList = lappend(*indexDDLEventList, makeTableDDLCommandString(
|
||||
statementDef));
|
||||
/*
|
||||
* Include indexes that are not backing constraints only when
|
||||
* explicitly asked.
|
||||
*/
|
||||
char *statementDef = pg_get_indexdef_string(indexId);
|
||||
*indexDDLEventList = lappend(*indexDDLEventList,
|
||||
makeTableDDLCommandString(statementDef));
|
||||
}
|
||||
|
||||
/* if table is clustered on this index, append definition to the list */
|
||||
|
|
|
@ -101,9 +101,11 @@ typedef enum TableDDLCommandType
|
|||
typedef enum IndexDefinitionDeparseFlags
|
||||
{
|
||||
INCLUDE_CREATE_INDEX_STATEMENTS = 1 << 0,
|
||||
INCLUDE_INDEX_CLUSTERED_STATEMENTS = 1 << 1,
|
||||
INCLUDE_INDEX_STATISTICS_STATEMENTTS = 1 << 2,
|
||||
INCLUDE_CREATE_CONSTRAINT_STATEMENTS = 1 << 1,
|
||||
INCLUDE_INDEX_CLUSTERED_STATEMENTS = 1 << 2,
|
||||
INCLUDE_INDEX_STATISTICS_STATEMENTTS = 1 << 3,
|
||||
INCLUDE_INDEX_ALL_STATEMENTS = INCLUDE_CREATE_INDEX_STATEMENTS |
|
||||
INCLUDE_CREATE_CONSTRAINT_STATEMENTS |
|
||||
INCLUDE_INDEX_CLUSTERED_STATEMENTS |
|
||||
INCLUDE_INDEX_STATISTICS_STATEMENTTS
|
||||
} IndexDefinitionDeparseFlags;
|
||||
|
|
Loading…
Reference in New Issue