Maybe we can remove the type cast in typecache.c

From: qinghao huang <wfnuser(at)hotmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Maybe we can remove the type cast in typecache.c
Date: 2023-02-28 09:56:00
Message-ID: ME3P282MB20515B5E0AB952E280DA7A4FA1AC9@ME3P282MB2051.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,
When I was reading postgres code, I found there is a wierd type cast. I'm pondering if it is necessary.

```
/* Allocate a new typmod number. This will be wasted if we error out. */
typmod = (int)
pg_atomic_fetch_add_u32(&CurrentSession->shared_typmod_registry->next_typmod,
1);

```
typmod has u32 type, but we cast it to int first.

And I also have some confusion about why `NextRecordTypmod` and `TupleDescData.tdtypmod` has type of int32, but `SharedTypmodTableEntry.typmod` has type of uint32.

Best regard,
Qinghao Huang

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kartyshov Ivan 2023-02-28 10:10:47 Re: [HACKERS] make async slave to wait for lsn to be replayed
Previous Message Drouvot, Bertrand 2023-02-28 09:49:13 Re: Track IO times in pg_stat_io