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. Guard against uninitialized default locale.

  1. Add a guard against uninitialized default locale

    Jeff Davis <pgsql@j-davis.com> — 2026-04-24T22:44:23Z

    Not known to be reachable after dbf217c1c7, but defend against similar
    issues in the future. For instance, an extension might encounter the
    problem by calling pg_newlocale_from_collation(DEFAULT_COLLATION_OID)
    from _PG_init(), and end up with a NULL pointer dereference.
    
    Backport through 17, though patch is different in 17 (also attached).
    
    Regards,
    	Jeff Davis
    
    
  2. Re: Add a guard against uninitialized default locale

    Jeff Davis <pgsql@j-davis.com> — 2026-05-14T22:00:46Z

    On Fri, 2026-04-24 at 15:44 -0700, Jeff Davis wrote:
    > Not known to be reachable after dbf217c1c7, but defend against
    > similar
    > issues in the future. For instance, an extension might encounter the
    > problem by calling pg_newlocale_from_collation(DEFAULT_COLLATION_OID)
    > from _PG_init(), and end up with a NULL pointer dereference.
    > 
    > Backport through 17, though patch is different in 17 (also attached).
    
    I plan to commit and backport this soon.
    
    Regards,
    	Jeff Davis
    
    
    
    
    
  3. Re: Add a guard against uninitialized default locale

    Ayush Tiwari <ayushtiwari.slg01@gmail.com> — 2026-05-15T03:42:11Z

    Hi,
    
    On Fri, 15 May 2026 at 03:30, Jeff Davis <pgsql@j-davis.com> wrote:
    
    > On Fri, 2026-04-24 at 15:44 -0700, Jeff Davis wrote:
    > > Not known to be reachable after dbf217c1c7, but defend against
    > > similar
    > > issues in the future. For instance, an extension might encounter the
    > > problem by calling pg_newlocale_from_collation(DEFAULT_COLLATION_OID)
    > > from _PG_init(), and end up with a NULL pointer dereference.
    > >
    > > Backport through 17, though patch is different in 17 (also attached).
    >
    > I plan to commit and backport this soon.
    >
    >
    The patch looks good to me as it is.
    
    Just one nit in PG 17 patch:
    
       The provider == '\0' sentinel is correct (valid
       providers are 'b'/'c'/'i'/'d', all nonzero) and the three guarded
       sites (lc_collate_is_c, lc_ctype_is_c, pg_newlocale_from_collation)
       cover the direct consumers symmetrically.  The only thing maybe
       consider is replacing the bare /* should not happen */ above the
       '\0' test with something like /* provider unset; init_database_-
       collation() not yet run */ -- the literal '\0' check reads as a bit
       magical otherwise, but maybe you are doing that to have same
       comment throughout.
    
    Regards,
    Ayush