Thread

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. ecpg: refactor to eliminate cast-away-const in find_variable().

  1. Refactor to eliminate cast-away-const in pg_dump object sort comparator

    Chao Li <li.evan.chao@gmail.com> — 2025-12-24T01:58:32Z

    Hi Hacker,
    
    While reviewing patch [1], I raised a comment about cast-away-const in
    pg_dump_sort.c. However, the comment was not accepted and the argument was
    that the nearby code did the same thing.
    
    I saw Tom recently had a commit [2] that removed some cast-away-const in
    ecpg, so I am filing this patch to eliminate all cast-away-const problems
    in pg_dump_sort.c.
    
    [1]
    https://postgr.es/m/CALDaNm2x3rd7C0_HjUpJFbxpAqXgm=QtoKfkEWDVA8h+JFpa_w@mail.gmail.com
    [2]
    https://git.postgresql.org/cgit/postgresql.git/commit/?id=4eda42e8bdf5bd3bf69576d54a45c10e7cbc3b35
    
    Best regards,
    --
    Chao Li (Evan)
    HighGo Software Co., Ltd.
    https://www.highgo.com/
    
  2. Re: Refactor to eliminate cast-away-const in pg_dump object sort comparator

    Chao Li <li.evan.chao@gmail.com> — 2025-12-29T09:44:22Z

    On Dec 24, 2025, at 09:58, Chao Li <li.evan.chao@gmail.com> wrote:
    
    Hi Hacker,
    
    While reviewing patch [1], I raised a comment about cast-away-const in
    pg_dump_sort.c. However, the comment was not accepted and the argument was
    that the nearby code did the same thing.
    
    I saw Tom recently had a commit [2] that removed some cast-away-const in
    ecpg, so I am filing this patch to eliminate all cast-away-const problems
    in pg_dump_sort.c.
    
    [1]
    https://postgr.es/m/CALDaNm2x3rd7C0_HjUpJFbxpAqXgm=QtoKfkEWDVA8h+JFpa_w@mail.gmail.com
    [2]
    https://git.postgresql.org/cgit/postgresql.git/commit/?id=4eda42e8bdf5bd3bf69576d54a45c10e7cbc3b35
    
    
    I just noticed this patch does the similar thing as [3] just handling a
    different file. As Peter had a comment on [3], I addressed the comment as
    well in v2.
    
    [3]
    https://postgr.es/m/aUQHy/MmWq7c97wK@ip-10-97-1-34.eu-west-3.compute.internal
    
    Best regards,
    --
    Chao Li (Evan)
    HighGo Software Co., Ltd.
    https://www.highgo.com/
    
  3. Re: Refactor to eliminate cast-away-const in pg_dump object sort comparator

    Bertrand Drouvot <bertranddrouvot.pg@gmail.com> — 2025-12-29T14:15:48Z

    Hi,
    
    On Mon, Dec 29, 2025 at 05:44:22PM +0800, Chao Li wrote:
    > On Dec 24, 2025, at 09:58, Chao Li <li.evan.chao@gmail.com> wrote:
    > 
    > Hi Hacker,
    > 
    > While reviewing patch [1], I raised a comment about cast-away-const in
    > pg_dump_sort.c. However, the comment was not accepted and the argument was
    > that the nearby code did the same thing.
    > 
    > I saw Tom recently had a commit [2] that removed some cast-away-const in
    > ecpg, so I am filing this patch to eliminate all cast-away-const problems
    > in pg_dump_sort.c.
    > 
    > [1]
    > https://postgr.es/m/CALDaNm2x3rd7C0_HjUpJFbxpAqXgm=QtoKfkEWDVA8h+JFpa_w@mail.gmail.com
    > [2]
    > https://git.postgresql.org/cgit/postgresql.git/commit/?id=4eda42e8bdf5bd3bf69576d54a45c10e7cbc3b35
    > 
    > 
    > I just noticed this patch does the similar thing as [3] just handling a
    > different file. As Peter had a comment on [3], I addressed the comment as
    > well in v2.
    
    I think that your v1 was correct but your v2 now contains things like:
    
    @@ -199,8 +199,8 @@ sortDumpableObjectsByTypeName(DumpableObject **objs, int numObjs)
     static int
     DOTypeNameCompare(const void *p1, const void *p2)
     {
    -       DumpableObject *obj1 = *(DumpableObject *const *) p1;
    -       DumpableObject *obj2 = *(DumpableObject *const *) p2;
    +       const DumpableObject *obj1 = p1;
    +       const DumpableObject *obj2 = p2;
    
    that don't look correct. Indeed in sortDumpableObjectsByTypeName(),
    objs is pointer to pointer. So qsort passes &objs[0] and &objs[1] to the
    comparator. So that dereference is still needed in DOTypeNameCompare().
    
    Regards,
    
    -- 
    Bertrand Drouvot
    PostgreSQL Contributors Team
    RDS Open Source Databases
    Amazon Web Services: https://aws.amazon.com
    
    
    
    
  4. Re: Refactor to eliminate cast-away-const in pg_dump object sort comparator

    Chao Li <li.evan.chao@gmail.com> — 2025-12-30T09:03:51Z

    On Mon, Dec 29, 2025 at 10:15 PM Bertrand Drouvot <
    bertranddrouvot.pg@gmail.com> wrote:
    
    > Hi,
    >
    > On Mon, Dec 29, 2025 at 05:44:22PM +0800, Chao Li wrote:
    > > On Dec 24, 2025, at 09:58, Chao Li <li.evan.chao@gmail.com> wrote:
    > >
    > > Hi Hacker,
    > >
    > > While reviewing patch [1], I raised a comment about cast-away-const in
    > > pg_dump_sort.c. However, the comment was not accepted and the argument
    > was
    > > that the nearby code did the same thing.
    > >
    > > I saw Tom recently had a commit [2] that removed some cast-away-const in
    > > ecpg, so I am filing this patch to eliminate all cast-away-const problems
    > > in pg_dump_sort.c.
    > >
    > > [1]
    > >
    > https://postgr.es/m/CALDaNm2x3rd7C0_HjUpJFbxpAqXgm=QtoKfkEWDVA8h+JFpa_w@mail.gmail.com
    > > [2]
    > >
    > https://git.postgresql.org/cgit/postgresql.git/commit/?id=4eda42e8bdf5bd3bf69576d54a45c10e7cbc3b35
    > >
    > >
    > > I just noticed this patch does the similar thing as [3] just handling a
    > > different file. As Peter had a comment on [3], I addressed the comment as
    > > well in v2.
    >
    > I think that your v1 was correct but your v2 now contains things like:
    >
    > @@ -199,8 +199,8 @@ sortDumpableObjectsByTypeName(DumpableObject **objs,
    > int numObjs)
    >  static int
    >  DOTypeNameCompare(const void *p1, const void *p2)
    >  {
    > -       DumpableObject *obj1 = *(DumpableObject *const *) p1;
    > -       DumpableObject *obj2 = *(DumpableObject *const *) p2;
    > +       const DumpableObject *obj1 = p1;
    > +       const DumpableObject *obj2 = p2;
    >
    > that don't look correct. Indeed in sortDumpableObjectsByTypeName(),
    > objs is pointer to pointer. So qsort passes &objs[0] and &objs[1] to the
    > comparator. So that dereference is still needed in DOTypeNameCompare().
    >
    > Regards,
    >
    > --
    > Bertrand Drouvot
    > PostgreSQL Contributors Team
    > RDS Open Source Databases
    > Amazon Web Services: https://aws.amazon.com
    
    
    Hi Bertrand,
    
    Thanks a lot for pointing out the error. v3 has reverted the changes to be
    the same as v1 and rebased.
    
    Best regards,
    --
    Chao Li (Evan)
    HighGo Software Co., Ltd.
    https://www.highgo.com/