From: | Junwang Zhao <zhjwpku(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Use RELATION_IS_OTHER_TEMP where possible |
Date: | 2025-06-10 16:07:35 |
Message-ID: | CAEG8a3LjTGJcOcxQx-SUOGoxstG4XuCWLH0ATJKKt_aBTE5K8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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/884bcf9e-d6e3-4b0c-8dcb-7f2110070ac9@postgrespro.ru
--
Regards
Junwang Zhao
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2025-06-10 16:21:37 | Re: add function for creating/attaching hash table in DSM registry |
Previous Message | Junwang Zhao | 2025-06-10 15:58:04 | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |