| From: | Japin Li <japinli(at)hotmail(dot)com> |
|---|---|
| To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
| Cc: | Kirill Reshke <reshkekirill(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Add IS_INDEX macro to brin and gist index |
| Date: | 2026-01-14 16:19:33 |
| Message-ID: | MEAPR01MB303130F8BE2CC25B494923B1B68FA@MEAPR01MB3031.ausprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 14 Jan 2026 at 16:40, Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
> On 2026-Jan-14, Japin Li wrote:
>
>> -#define IS_INDEX(r) ((r)->rd_rel->relkind == RELKIND_INDEX)
>> -#define IS_BTREE(r) ((r)->rd_rel->relam == BTREE_AM_OID)
>> +#define IS_BTREE(r) (IS_INDEX(r) && (r)->rd_rel->relam == BTREE_AM_OID)
>
> I find this coding rather pointless. You can more easily do something
> like
>
> #define IS_BTREE(r) ((r)->rd_rel->relkind == RELKIND_INDEX && (r)->rd_rel->relam == BTREE_AM_OID)
>
> and get rid of the IS_INDEX macro completely, if it's not used anywhere
> else. Same for all the other index AMs.
>
Thanks for the review.
I've fixed it according to your suggestion.
> --
> Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Check-relkind-for-both-BRIN-and-GIST-indexes.patch | text/x-patch | 4.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2026-01-14 16:23:05 | Re: Buffer locking is special (hints, checksums, AIO writes) |
| Previous Message | Anthonin Bonnefoy | 2026-01-14 16:12:45 | Re: LLVM 22 |