mirror of https://github.com/citusdata/citus.git
Remove direct access to tupleDesc->attrs
A level of indirection was removed from this field for PostgreSQL 11. By using the handy provided macro, we can be version agnostic.pull/1633/head
parent
6a020b5adc
commit
fbeaa2f9d0
|
@ -1284,7 +1284,7 @@ TupleDescColumnNameList(TupleDesc tupleDescriptor)
|
|||
|
||||
for (columnIndex = 0; columnIndex < tupleDescriptor->natts; columnIndex++)
|
||||
{
|
||||
Form_pg_attribute currentColumn = tupleDescriptor->attrs[columnIndex];
|
||||
Form_pg_attribute currentColumn = TupleDescAttr(tupleDescriptor, columnIndex);
|
||||
char *columnName = NameStr(currentColumn->attname);
|
||||
|
||||
if (currentColumn->attisdropped)
|
||||
|
@ -1311,7 +1311,7 @@ RelationUsesIdentityColumns(TupleDesc relationDesc)
|
|||
|
||||
for (attributeIndex = 0; attributeIndex < relationDesc->natts; attributeIndex++)
|
||||
{
|
||||
Form_pg_attribute attributeForm = relationDesc->attrs[attributeIndex];
|
||||
Form_pg_attribute attributeForm = TupleDescAttr(relationDesc, attributeIndex);
|
||||
|
||||
if (attributeForm->attidentity != '\0')
|
||||
{
|
||||
|
|
|
@ -334,7 +334,7 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
|||
/* build the list of column names for remote COPY statements */
|
||||
for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
|
||||
{
|
||||
Form_pg_attribute currentColumn = tupleDescriptor->attrs[columnIndex];
|
||||
Form_pg_attribute currentColumn = TupleDescAttr(tupleDescriptor, columnIndex);
|
||||
char *columnName = NameStr(currentColumn->attname);
|
||||
|
||||
if (currentColumn->attisdropped)
|
||||
|
@ -892,7 +892,7 @@ CanUseBinaryCopyFormat(TupleDesc tupleDescription)
|
|||
|
||||
for (columnIndex = 0; columnIndex < totalColumnCount; columnIndex++)
|
||||
{
|
||||
Form_pg_attribute currentColumn = tupleDescription->attrs[columnIndex];
|
||||
Form_pg_attribute currentColumn = TupleDescAttr(tupleDescription, columnIndex);
|
||||
Oid typeId = InvalidOid;
|
||||
char typeCategory = '\0';
|
||||
bool typePreferred = false;
|
||||
|
@ -1231,7 +1231,7 @@ ColumnOutputFunctions(TupleDesc rowDescriptor, bool binaryFormat)
|
|||
for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
|
||||
{
|
||||
FmgrInfo *currentOutputFunction = &columnOutputFunctions[columnIndex];
|
||||
Form_pg_attribute currentColumn = rowDescriptor->attrs[columnIndex];
|
||||
Form_pg_attribute currentColumn = TupleDescAttr(rowDescriptor, columnIndex);
|
||||
Oid columnTypeId = currentColumn->atttypid;
|
||||
Oid outputFunctionId = InvalidOid;
|
||||
bool typeVariableLength = false;
|
||||
|
@ -1282,7 +1282,7 @@ AppendCopyRowData(Datum *valueArray, bool *isNullArray, TupleDesc rowDescriptor,
|
|||
}
|
||||
for (columnIndex = 0; columnIndex < totalColumnCount; columnIndex++)
|
||||
{
|
||||
Form_pg_attribute currentColumn = rowDescriptor->attrs[columnIndex];
|
||||
Form_pg_attribute currentColumn = TupleDescAttr(rowDescriptor, columnIndex);
|
||||
Datum value = valueArray[columnIndex];
|
||||
bool isNull = isNullArray[columnIndex];
|
||||
bool lastColumn = false;
|
||||
|
@ -1357,7 +1357,7 @@ AvailableColumnCount(TupleDesc tupleDescriptor)
|
|||
|
||||
for (columnIndex = 0; columnIndex < tupleDescriptor->natts; columnIndex++)
|
||||
{
|
||||
Form_pg_attribute currentColumn = tupleDescriptor->attrs[columnIndex];
|
||||
Form_pg_attribute currentColumn = TupleDescAttr(tupleDescriptor, columnIndex);
|
||||
|
||||
if (!currentColumn->attisdropped)
|
||||
{
|
||||
|
|
|
@ -108,10 +108,10 @@ master_run_on_worker(PG_FUNCTION_ARGS)
|
|||
* Check to make sure we have correct tuple descriptor
|
||||
*/
|
||||
if (tupleDescriptor->natts != 4 ||
|
||||
tupleDescriptor->attrs[0]->atttypid != TEXTOID ||
|
||||
tupleDescriptor->attrs[1]->atttypid != INT4OID ||
|
||||
tupleDescriptor->attrs[2]->atttypid != BOOLOID ||
|
||||
tupleDescriptor->attrs[3]->atttypid != TEXTOID)
|
||||
TupleDescAttr(tupleDescriptor, 0)->atttypid != TEXTOID ||
|
||||
TupleDescAttr(tupleDescriptor, 1)->atttypid != INT4OID ||
|
||||
TupleDescAttr(tupleDescriptor, 2)->atttypid != BOOLOID ||
|
||||
TupleDescAttr(tupleDescriptor, 3)->atttypid != TEXTOID)
|
||||
{
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_COLUMN_DEFINITION),
|
||||
|
|
|
@ -984,7 +984,7 @@ TypeOfColumn(Oid tableId, int16 columnId)
|
|||
{
|
||||
Relation tableRelation = relation_open(tableId, NoLock);
|
||||
TupleDesc tupleDescriptor = RelationGetDescr(tableRelation);
|
||||
Form_pg_attribute attrForm = tupleDescriptor->attrs[columnId - 1];
|
||||
Form_pg_attribute attrForm = TupleDescAttr(tupleDescriptor, columnId - 1);
|
||||
relation_close(tableRelation, NoLock);
|
||||
return attrForm->atttypid;
|
||||
}
|
||||
|
|
|
@ -262,7 +262,8 @@ ConvertRteToSubqueryWithEmptyResult(RangeTblEntry *rte)
|
|||
|
||||
for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
|
||||
{
|
||||
FormData_pg_attribute *attributeForm = tupleDescriptor->attrs[columnIndex];
|
||||
FormData_pg_attribute *attributeForm = TupleDescAttr(tupleDescriptor,
|
||||
columnIndex);
|
||||
TargetEntry *targetEntry = NULL;
|
||||
StringInfo resname = NULL;
|
||||
Const *constValue = NULL;
|
||||
|
|
|
@ -333,7 +333,7 @@ pg_get_tableschemadef_string(Oid tableRelationId, bool includeSequenceDefaults)
|
|||
|
||||
for (attributeIndex = 0; attributeIndex < tupleDescriptor->natts; attributeIndex++)
|
||||
{
|
||||
Form_pg_attribute attributeForm = tupleDescriptor->attrs[attributeIndex];
|
||||
Form_pg_attribute attributeForm = TupleDescAttr(tupleDescriptor, attributeIndex);
|
||||
|
||||
/*
|
||||
* We disregard the inherited attributes (i.e., attinhcount > 0) here. The
|
||||
|
@ -545,7 +545,7 @@ pg_get_tablecolumnoptionsdef_string(Oid tableRelationId)
|
|||
|
||||
for (attributeIndex = 0; attributeIndex < tupleDescriptor->natts; attributeIndex++)
|
||||
{
|
||||
Form_pg_attribute attributeForm = tupleDescriptor->attrs[attributeIndex];
|
||||
Form_pg_attribute attributeForm = TupleDescAttr(tupleDescriptor, attributeIndex);
|
||||
char *attributeName = NameStr(attributeForm->attname);
|
||||
char defaultStorageType = get_typstorage(attributeForm->atttypid);
|
||||
|
||||
|
|
Loading…
Reference in New Issue