Thread

  1. Fix casting away const in _bt_reorder_array_cmp

    Chao Li <li.evan.chao@gmail.com> — 2025-12-31T07:51:55Z

    Hi Hackers,
    
    There have been several recent efforts to eliminate cast-away-const usages.
    While reviewing another patch, I happened to notice one such occurrence, so
    I’m posting a trivial patch to fix it.
    
    Best regards,
    --
    Chao Li (Evan)
    HighGo Software Co., Ltd.
    https://www.highgo.com/
    
  2. Re: Fix casting away const in _bt_reorder_array_cmp

    Bertrand Drouvot <bertranddrouvot.pg@gmail.com> — 2025-12-31T09:01:32Z

    Hi,
    
    On Wed, Dec 31, 2025 at 03:51:55PM +0800, Chao Li wrote:
    > Hi Hackers,
    > 
    > There have been several recent efforts to eliminate cast-away-const usages.
    > While reviewing another patch, I happened to notice one such occurrence, so
    > I’m posting a trivial patch to fix it.
    
    Thanks for the patch!
    
    This one is one that I choose to discard in [1] because this is just a thin
    wrapper. Not saying that keeping cast away const was a good thing but the idea
    was also to reduce the number of changes in the patch.
    
    The criteria was:
    
    "
    Indeed, I did some filtering and decided not to change the ones
    that:
    
    - are just thin wrappers
    - would require public API changes
    - rely on external functions (such as LZ4F_compressUpdate())
    - would require changes beyond the scope of this cleanup"
    
    That said, also removing explicit casts when assigning from void pointers
    (relying on implicit conversion instead) is also valuable and your patch does
    exactly this.
    
    That could be part of a larger project though (as mentioned in [2]).
    
    Thoughts?
    
    [1]: https://www.postgresql.org/message-id/flat/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal
    [2]: https://www.postgresql.org/message-id/aVTiCHBalaFCneYD%40ip-10-97-1-34.eu-west-3.compute.internal
    
    Regards,
    
    -- 
    Bertrand Drouvot
    PostgreSQL Contributors Team
    RDS Open Source Databases
    Amazon Web Services: https://aws.amazon.com