pointless check in RelationBuildPartitionDesc
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-09-03T21:39:16Z
Lists: pgsql-hackers
Attachments
- ispartition.patch (text/plain) patch
I noticed this strange hack in RelationBuildPartitionDesc:
/*
* It is possible that the pg_class tuple of a partition has not been
* updated yet to set its relpartbound field. The only case where
* this happens is when we open the parent relation to check using its
* partition descriptor that a new partition's bound does not overlap
* some existing partition.
*/
if (!((Form_pg_class) GETSTRUCT(tuple))->relispartition)
{
ReleaseSysCache(tuple);
continue;
}
After looking, it seems that this is just self-inflicted pain: for some
reason, we store the pg_inherits row for a partition, and immediately
afterwards compute and store its partition bound, which requires the
above hack. But if we do things in the opposite order, this is no
longer needed. I propose to remove it, as in the attached patch.
--
Álvaro Herrera Developer, https://www.PostgreSQL.org/
Commits
-
Simplify partitioned table creation vs. relcache
- 52ab02d593e9 11.0 landed
- 2fbdf1b38bc5 12.0 landed