mirror of https://github.com/citusdata/citus.git
Replace heap_getattr with heap_deform_tuple & fix multi_metadata_attributes.sql
parent
5f6913e82e
commit
538f8913f5
|
@ -3971,23 +3971,19 @@ CitusTableTypeIdList(CitusTableType citusTableType)
|
||||||
HeapTuple heapTuple = systable_getnext(scanDescriptor);
|
HeapTuple heapTuple = systable_getnext(scanDescriptor);
|
||||||
while (HeapTupleIsValid(heapTuple))
|
while (HeapTupleIsValid(heapTuple))
|
||||||
{
|
{
|
||||||
bool isNull = false;
|
bool isNullArray[Natts_pg_dist_partition];
|
||||||
|
Datum datumArray[Natts_pg_dist_partition];
|
||||||
|
heap_deform_tuple(heapTuple, tupleDescriptor, datumArray, isNullArray);
|
||||||
|
|
||||||
Datum partMethodDatum =
|
Datum partMethodDatum = datumArray[Anum_pg_dist_partition_partmethod - 1];
|
||||||
heap_getattr(heapTuple, Anum_pg_dist_partition_partmethod,
|
Datum replicationModelDatum = datumArray[Anum_pg_dist_partition_repmodel - 1];
|
||||||
tupleDescriptor, &isNull);
|
|
||||||
Datum replicationModelDatum =
|
|
||||||
heap_getattr(heapTuple, Anum_pg_dist_partition_repmodel,
|
|
||||||
tupleDescriptor, &isNull);
|
|
||||||
|
|
||||||
Oid partitionMethod = DatumGetChar(partMethodDatum);
|
Oid partitionMethod = DatumGetChar(partMethodDatum);
|
||||||
Oid replicationModel = DatumGetChar(replicationModelDatum);
|
Oid replicationModel = DatumGetChar(replicationModelDatum);
|
||||||
|
|
||||||
if (IsCitusTableTypeInternal(partitionMethod, replicationModel, citusTableType))
|
if (IsCitusTableTypeInternal(partitionMethod, replicationModel, citusTableType))
|
||||||
{
|
{
|
||||||
Datum relationIdDatum = heap_getattr(heapTuple,
|
Datum relationIdDatum = datumArray[Anum_pg_dist_partition_logicalrelid - 1];
|
||||||
Anum_pg_dist_partition_logicalrelid,
|
|
||||||
tupleDescriptor, &isNull);
|
|
||||||
|
|
||||||
Oid relationId = DatumGetObjectId(relationIdDatum);
|
Oid relationId = DatumGetObjectId(relationIdDatum);
|
||||||
|
|
||||||
|
|
|
@ -947,10 +947,11 @@ ColocationGroupTableList(uint32 colocationId, uint32 count)
|
||||||
HeapTuple heapTuple = systable_getnext(scanDescriptor);
|
HeapTuple heapTuple = systable_getnext(scanDescriptor);
|
||||||
while (HeapTupleIsValid(heapTuple))
|
while (HeapTupleIsValid(heapTuple))
|
||||||
{
|
{
|
||||||
bool isNull = false;
|
bool isNullArray[Natts_pg_dist_partition];
|
||||||
Oid colocatedTableId = heap_getattr(heapTuple,
|
Datum datumArray[Natts_pg_dist_partition];
|
||||||
Anum_pg_dist_partition_logicalrelid,
|
heap_deform_tuple(heapTuple, tupleDescriptor, datumArray, isNullArray);
|
||||||
tupleDescriptor, &isNull);
|
Oid colocatedTableId = DatumGetObjectId(
|
||||||
|
datumArray[Anum_pg_dist_partition_logicalrelid - 1]);
|
||||||
|
|
||||||
colocatedTableList = lappend_oid(colocatedTableList, colocatedTableId);
|
colocatedTableList = lappend_oid(colocatedTableList, colocatedTableId);
|
||||||
heapTuple = systable_getnext(scanDescriptor);
|
heapTuple = systable_getnext(scanDescriptor);
|
||||||
|
@ -1116,7 +1117,6 @@ ColocatedTableId(Oid colocationId)
|
||||||
{
|
{
|
||||||
Oid colocatedTableId = InvalidOid;
|
Oid colocatedTableId = InvalidOid;
|
||||||
bool indexOK = true;
|
bool indexOK = true;
|
||||||
bool isNull = false;
|
|
||||||
ScanKeyData scanKey[1];
|
ScanKeyData scanKey[1];
|
||||||
int scanKeyCount = 1;
|
int scanKeyCount = 1;
|
||||||
|
|
||||||
|
@ -1141,8 +1141,11 @@ ColocatedTableId(Oid colocationId)
|
||||||
HeapTuple heapTuple = systable_getnext(scanDescriptor);
|
HeapTuple heapTuple = systable_getnext(scanDescriptor);
|
||||||
while (HeapTupleIsValid(heapTuple))
|
while (HeapTupleIsValid(heapTuple))
|
||||||
{
|
{
|
||||||
colocatedTableId = heap_getattr(heapTuple, Anum_pg_dist_partition_logicalrelid,
|
bool isNullArray[Natts_pg_dist_partition];
|
||||||
tupleDescriptor, &isNull);
|
Datum datumArray[Natts_pg_dist_partition];
|
||||||
|
heap_deform_tuple(heapTuple, tupleDescriptor, datumArray, isNullArray);
|
||||||
|
colocatedTableId = DatumGetObjectId(
|
||||||
|
datumArray[Anum_pg_dist_partition_logicalrelid - 1]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the relation isn't dropped for the remainder of
|
* Make sure the relation isn't dropped for the remainder of
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
-- part of the query so new changes to it won't affect this test.
|
-- part of the query so new changes to it won't affect this test.
|
||||||
SELECT attrelid::regclass, attname, atthasmissing, attmissingval
|
SELECT attrelid::regclass, attname, atthasmissing, attmissingval
|
||||||
FROM pg_attribute
|
FROM pg_attribute
|
||||||
WHERE atthasmissing AND attrelid NOT IN ('pg_dist_node'::regclass, 'pg_dist_rebalance_strategy'::regclass)
|
WHERE atthasmissing AND attrelid NOT IN ('pg_dist_node'::regclass,
|
||||||
|
'pg_dist_rebalance_strategy'::regclass,
|
||||||
|
'pg_dist_partition'::regclass)
|
||||||
ORDER BY attrelid, attname;
|
ORDER BY attrelid, attname;
|
||||||
attrelid | attname | atthasmissing | attmissingval
|
attrelid | attname | atthasmissing | attmissingval
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
|
@ -7,5 +7,7 @@
|
||||||
-- part of the query so new changes to it won't affect this test.
|
-- part of the query so new changes to it won't affect this test.
|
||||||
SELECT attrelid::regclass, attname, atthasmissing, attmissingval
|
SELECT attrelid::regclass, attname, atthasmissing, attmissingval
|
||||||
FROM pg_attribute
|
FROM pg_attribute
|
||||||
WHERE atthasmissing AND attrelid NOT IN ('pg_dist_node'::regclass, 'pg_dist_rebalance_strategy'::regclass)
|
WHERE atthasmissing AND attrelid NOT IN ('pg_dist_node'::regclass,
|
||||||
|
'pg_dist_rebalance_strategy'::regclass,
|
||||||
|
'pg_dist_partition'::regclass)
|
||||||
ORDER BY attrelid, attname;
|
ORDER BY attrelid, attname;
|
||||||
|
|
Loading…
Reference in New Issue