Thread

  1. ISBN range table

    Thomas Munro <thomas.munro@gmail.com> — 2026-04-12T11:37:19Z

    Hi,
    
    A recent-ish thread[1] made me wonder what that big table of data
    does, and why we have a random update every decade or so, and I came
    up with the attached.
    
    It's pretty low stakes stuff: it controls where hyphens are inserted.
    This happens when new ranges are carved out for publishers, so to pick
    an example ISBN plucked from Wikipedia[2], here's an ISBN that is
    shown differently after the attached:
    
    postgres=# select '9791186178140'::isbn;
          isbn
    -----------------
     979-118617814-0
    (1 row)
    
    postgres=# select '9791186178140'::isbn;
           isbn
    -------------------
     979-11-86178-14-0
    
    [1] https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org
    [2] https://en.wikipedia.org/wiki/List_of_ISBN_registration_groups
    
  2. Re: ISBN range table

    Thomas Munro <thomas.munro@gmail.com> — 2026-04-14T03:04:32Z

    On Sun, Apr 12, 2026 at 11:37 PM Thomas Munro <thomas.munro@gmail.com> wrote:
    > A recent-ish thread[1] made me wonder what that big table of data
    > does, and why we have a random update every decade or so, and I came
    > up with the attached.
    
    Fixed a couple of typos and added as commitfest #6676.  The idea is
    that update_isbn.py would become another periodic update task, similar
    to Unicode, contrib/unaccent and the IANA timezone stuff.  I suppose
    running it only for major releases would be enough for such
    non-critical data.  There are also some other much smaller tables in
    this contrib module, but they don't seem to be moving (?) so I didn't
    look at them.
    
    I'm not volunteering today, but a passing thought I had while browsing
    this complicated code full of scary pointer arithmetic is that it
    might be an idea to try to describe the entire EAN3 number space in a
    much simpler single binary-searchable array that maps uint64_t ranges
    to TO_CHAR format strings, with entries that look something like:
    
     {9780037000000, 9780638999999, "999-9-99-999999-9"}
    
  3. Re: ISBN range table

    Florents Tselai <florents.tselai@gmail.com> — 2026-04-14T15:32:47Z

    On Tue, Apr 14, 2026 at 6:05 AM Thomas Munro <thomas.munro@gmail.com> wrote:
    
    > On Sun, Apr 12, 2026 at 11:37 PM Thomas Munro <thomas.munro@gmail.com>
    > wrote:
    > > A recent-ish thread[1] made me wonder what that big table of data
    > > does, and why we have a random update every decade or so, and I came
    > > up with the attached.
    >
    > Fixed a couple of typos and added as commitfest #6676.  The idea is
    > that update_isbn.py would become another periodic update task, similar
    > to Unicode, contrib/unaccent and the IANA timezone stuff.  I suppose
    > running it only for major releases would be enough for such
    > non-critical data.  There are also some other much smaller tables in
    > this contrib module, but they don't seem to be moving (?) so I didn't
    > look at them.
    >
    > I'm not volunteering today, but a passing thought I had while browsing
    > this complicated code full of scary pointer arithmetic is that it
    > might be an idea to try to describe the entire EAN3 number space in a
    > much simpler single binary-searchable array that maps uint64_t ranges
    > to TO_CHAR format strings, with entries that look something like:
    >
    >  {9780037000000, 9780638999999, "999-9-99-999999-9"}
    >
    
     Nitpick; I'd just use standard python and avoid import requests .