Hi hackers,
While reviewing the Merge/Split partitions patch[0], I found
some places in tablecmds.c where RELATION_IS_OTHER_TEMP
can be used but not, such as:
/* If the parent is temp, it must belong to this session */
if (rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
!rel->rd_islocaltemp)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot attach as partition of temporary relation of another session")));
/* Ditto for the partition */
if (attachrel->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
!attachrel->rd_islocaltemp)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot attach temporary relation of another session as partition")));
All other files perform this check using RELATION_IS_OTHER_TEMP.
Should we update tablecmds.c to do the same for consistency?
[0]
https://www.postgresql.org/message-id/[email protected]
--
Regards
Junwang Zhao