Don't call CheckAttributeType() with InvalidOid on dropped cols

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: d54e75441518da3207fa5a44f34d300956d3c2c2
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2026-04-23T18:31:45Z
Releases: 17.10
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

Files

PathChange+/−
src/backend/catalog/heap.c modified +7 −3

Discussion