mirror of
https://github.com/postgres/postgres.git
synced 2026-05-25 10:43:53 -04:00
Don't call CheckAttributeType() with InvalidOid on dropped cols
If CheckAttributeType() is called with InvalidOid, it performs a bunch of pointless, futile syscache lookups with InvalidOid, but ultimately tolerates it and has no effect. We were calling it with InvalidOid on dropped columns, but it seems accidental that it works, so let's stop doing it. Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://www.postgresql.org/message-id/93ce56cd-02a6-4db1-8224-c8999372facc@iki.fi Backpatch-through: 14
This commit is contained in:
parent
54343f6f90
commit
d54e754415
1 changed files with 7 additions and 3 deletions
|
|
@ -509,9 +509,13 @@ CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind,
|
|||
*/
|
||||
for (i = 0; i < natts; i++)
|
||||
{
|
||||
CheckAttributeType(NameStr(TupleDescAttr(tupdesc, i)->attname),
|
||||
TupleDescAttr(tupdesc, i)->atttypid,
|
||||
TupleDescAttr(tupdesc, i)->attcollation,
|
||||
Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
|
||||
|
||||
if (attr->attisdropped)
|
||||
continue;
|
||||
CheckAttributeType(NameStr(attr->attname),
|
||||
attr->atttypid,
|
||||
attr->attcollation,
|
||||
NIL, /* assume we're creating a new rowtype */
|
||||
flags);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue