Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite4597ee

Browse files
committed
InsertPgAttributeTuple() to set attcacheoff
InsertPgAttributeTuple() is the interface between in-memory tupledescriptors and on-disk pg_attribute, so it makes sense to give it thejob of resetting attcacheoff. This avoids having all the callers havingto do so.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
1 parent520acab commite4597ee

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

‎src/backend/catalog/heap.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,8 @@ CheckAttributeType(const char *attname,
592592
*Construct and insert a new tuple in pg_attribute.
593593
*
594594
* Caller has already opened and locked pg_attribute. new_attribute is the
595-
* attribute to insert (but we ignore attacl and attoptions, which are always
596-
* initialized to NULL).
595+
* attribute to insert. attcacheoff is always initialized to -1, attacl and
596+
*attoptions are alwaysinitialized to NULL.
597597
*
598598
* indstate is the index state for CatalogTupleInsertWithInfo. It can be
599599
* passed as NULL, in which case we'll fetch the necessary info. (Don't do
@@ -620,7 +620,7 @@ InsertPgAttributeTuple(Relation pg_attribute_rel,
620620
values[Anum_pg_attribute_attlen-1]=Int16GetDatum(new_attribute->attlen);
621621
values[Anum_pg_attribute_attnum-1]=Int16GetDatum(new_attribute->attnum);
622622
values[Anum_pg_attribute_attndims-1]=Int32GetDatum(new_attribute->attndims);
623-
values[Anum_pg_attribute_attcacheoff-1]=Int32GetDatum(new_attribute->attcacheoff);
623+
values[Anum_pg_attribute_attcacheoff-1]=Int32GetDatum(-1);
624624
values[Anum_pg_attribute_atttypmod-1]=Int32GetDatum(new_attribute->atttypmod);
625625
values[Anum_pg_attribute_attbyval-1]=BoolGetDatum(new_attribute->attbyval);
626626
values[Anum_pg_attribute_attstorage-1]=CharGetDatum(new_attribute->attstorage);
@@ -689,9 +689,8 @@ AddNewAttributeTuples(Oid new_rel_oid,
689689
attr=TupleDescAttr(tupdesc,i);
690690
/* Fill in the correct relation OID */
691691
attr->attrelid=new_rel_oid;
692-
/* Make surethese are OK, too */
692+
/* Make surethis is OK, too */
693693
attr->attstattarget=-1;
694-
attr->attcacheoff=-1;
695694

696695
InsertPgAttributeTuple(rel,attr,indstate);
697696

‎src/backend/catalog/index.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
557557
{
558558
Form_pg_attributeattr=TupleDescAttr(indexTupDesc,i);
559559

560-
/*
561-
* There used to be very grotty code here to set these fields, but I
562-
* think it's unnecessary. They should be set already.
563-
*/
564560
Assert(attr->attnum==i+1);
565-
Assert(attr->attcacheoff==-1);
566561

567562
InsertPgAttributeTuple(pg_attribute,attr,indstate);
568563
}

‎src/backend/commands/tablecmds.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5522,7 +5522,6 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
55225522
attribute.atttypid=typeOid;
55235523
attribute.attstattarget= (newattnum>0) ?-1 :0;
55245524
attribute.attlen=tform->typlen;
5525-
attribute.attcacheoff=-1;
55265525
attribute.atttypmod=typmod;
55275526
attribute.attnum=newattnum;
55285527
attribute.attbyval=tform->typbyval;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp