mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Make more use of RELATION_IS_OTHER_TEMP().
A few places were open-coding it instead of using this handy macro. Author: Junwang Zhao <zhjwpku@gmail.com> Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Discussion: https://postgr.es/m/CAEG8a3LjTGJcOcxQx-SUOGoxstG4XuCWLH0ATJKKt_aBTE5K8w%40mail.gmail.com
This commit is contained in:
@ -2711,8 +2711,7 @@ MergeAttributes(List *columns, const List *supers, char relpersistence,
|
|||||||
RelationGetRelationName(relation))));
|
RelationGetRelationName(relation))));
|
||||||
|
|
||||||
/* If existing rel is temp, it must belong to this session */
|
/* If existing rel is temp, it must belong to this session */
|
||||||
if (relation->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
|
if (RELATION_IS_OTHER_TEMP(relation))
|
||||||
!relation->rd_islocaltemp)
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg(!is_partition
|
errmsg(!is_partition
|
||||||
@ -17230,15 +17229,13 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent, LOCKMODE lockmode)
|
|||||||
RelationGetRelationName(parent_rel))));
|
RelationGetRelationName(parent_rel))));
|
||||||
|
|
||||||
/* If parent rel is temp, it must belong to this session */
|
/* If parent rel is temp, it must belong to this session */
|
||||||
if (parent_rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
|
if (RELATION_IS_OTHER_TEMP(parent_rel))
|
||||||
!parent_rel->rd_islocaltemp)
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("cannot inherit from temporary relation of another session")));
|
errmsg("cannot inherit from temporary relation of another session")));
|
||||||
|
|
||||||
/* Ditto for the child */
|
/* Ditto for the child */
|
||||||
if (child_rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
|
if (RELATION_IS_OTHER_TEMP(child_rel))
|
||||||
!child_rel->rd_islocaltemp)
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("cannot inherit to temporary relation of another session")));
|
errmsg("cannot inherit to temporary relation of another session")));
|
||||||
@ -20309,15 +20306,13 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd,
|
|||||||
RelationGetRelationName(rel))));
|
RelationGetRelationName(rel))));
|
||||||
|
|
||||||
/* If the parent is temp, it must belong to this session */
|
/* If the parent is temp, it must belong to this session */
|
||||||
if (rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
|
if (RELATION_IS_OTHER_TEMP(rel))
|
||||||
!rel->rd_islocaltemp)
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("cannot attach as partition of temporary relation of another session")));
|
errmsg("cannot attach as partition of temporary relation of another session")));
|
||||||
|
|
||||||
/* Ditto for the partition */
|
/* Ditto for the partition */
|
||||||
if (attachrel->rd_rel->relpersistence == RELPERSISTENCE_TEMP &&
|
if (RELATION_IS_OTHER_TEMP(attachrel))
|
||||||
!attachrel->rd_islocaltemp)
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("cannot attach temporary relation of another session as partition")));
|
errmsg("cannot attach temporary relation of another session as partition")));
|
||||||
|
Reference in New Issue
Block a user