add code for get right indexkey

Signed-off-by: xiliu <xiliu_h@163.com>
This commit is contained in:
xiliu 2020-09-04 16:06:48 +08:00
parent 9b6ccd24cc
commit 13aa9ff1f9
3 changed files with 5 additions and 3 deletions

View File

@ -40,6 +40,7 @@
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "catalog/heap.h"
#include "executor/spi.h"
#include "foreign/foreign.h"
#include "mb/pg_wchar.h"
@ -1786,7 +1787,7 @@ static char** get_pkey_attnames(Relation rel, int16* indnkeyatts)
/* we're only interested if it is the primary key */
if (index->indisprimary) {
*indnkeyatts = index->indnkeyatts;
*indnkeyatts = GetIndexKeyAttsByTuple(NULL, indexTuple);
if (*indnkeyatts > 0) {
result = (char**)palloc(*indnkeyatts * sizeof(char*));

View File

@ -17,6 +17,7 @@
#include "knl/knl_variable.h"
#include "executor/spi.h"
#include "catalog/heap.h"
#include "commands/async.h"
#include "commands/trigger.h"
#include "lib/stringinfo.h"
@ -136,7 +137,7 @@ Datum triggered_change_notification(PG_FUNCTION_ARGS)
index = (Form_pg_index)GETSTRUCT(indexTuple);
/* we're only interested if it is the primary key and valid */
if (index->indisprimary && IndexIsValid(index)) {
int indnkeyatts = index->indnkeyatts;
int indnkeyatts = GetIndexKeyAttsByTuple(NULL, indexTuple);
if (indnkeyatts > 0) {
int i;

View File

@ -1731,7 +1731,7 @@ static void UpdateWaitCleanGpiRelOptions(Relation pgPartition, HeapTuple partTup
CatalogUpdateIndexes(pgPartition, newTuple);
}
ereport(LOG, (errmsg("partition %u set reloptions wait_clean_gpi=n success", HeapTupleGetOid(partTuple))));
ereport(LOG, (errmsg("partition %u set reloptions wait_clean_gpi success", HeapTupleGetOid(partTuple))));
heap_freetuple_ext(newTuple);
}