Re: [PATCH] Use DatumGetUInt32() for dsm_attach() in test_shm_mq_main()
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Jianghua Yang <yjhjstz@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-06-26T20:30:57Z
Lists: pgsql-hackers
On Thu, Jun 26, 2025 at 12:51:10PM -0700, Jianghua Yang wrote: > The argument passed to `dsm_attach()` is expected to be a `uint32`, but the > code currently uses `DatumGetInt32()` to extract it from the `Datum` > argument. This can lead to incorrect behavior when the high bit is set, as > 'unable to map dynamic shared memory segment'. I'm not sure this actually causes any problems in practice because dsm_attach() treats its argument as unsigned. In any case, I've never seen this test fail like that, and presumably the high bit is sometimes set because the handle is generated with a PRNG. Nevertheless, I see no point in using the wrong macro. I'll plan on committing/back-patching this shortly. -- nathan
Commits
-
Use correct DatumGet*() function in test_shm_mq_main().
- e2f06282124b 14.19 landed
- bf377c21a64a 13.22 landed
- bbccf7ecb363 18.0 landed
- 4dc48ad28d96 15.14 landed
- 07402e370e5b 17.6 landed
- 01f26f5c2e45 16.10 landed