Re: BUG #13442: ISBN doesn't always roundtrip with text

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: bz(at)mailinator(dot)com, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
Date: 2015-06-15 22:47:01
Message-ID: CAM3SWZTvh+g2-S1TzUBrbmNthanhFv4=8k3d-QjMd6Dzr8fo_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jun 15, 2015 at 10:26 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I poked at this a little bit. I think the issue may be that this bit
> at line 832 in isn.c:
>
> case ISBN:
> memcpy(buf, "978", 3);
>
> supposes that all ISBNs should have prefix 978, whereas your example is
> using prefix 979, which seems to be also valid according to code a few
> lines above.

I actually didn't realize that the ISBN type assumed the "bookland"
country code, which is 978. That's terrible, and is really a distinct
way that the type is broken (distinct from the range enforcement
misfeature that I always go on about).

I was planning on suggesting completely removing any enforcement of
ISBN ranges by the ISBN type. We could then rely entirely on the check
digit, which has virtually no disadvantage relative to "more complete"
enforcement. But even that's not going to help here, because the ISBN
output function doesn't show the country code or the check digit:

postgres=# select '978-0-393-04002-9'::isbn;
isbn
---------------
0-393-04002-X
(1 row)

--
Peter Geoghegan

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2015-06-16 00:06:14 Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
Previous Message Thomas Munro 2015-06-15 20:07:23 Re: BUG #13440: unaccent does not remove all diacritics