Re: BUG #13442: ISBN doesn't always roundtrip with text - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: BUG #13442: ISBN doesn't always roundtrip with text
Date
Msg-id CAM3SWZTvh+g2-S1TzUBrbmNthanhFv4=8k3d-QjMd6Dzr8fo_Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13442: ISBN doesn't always roundtrip with text  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Mon, Jun 15, 2015 at 10:26 AM, Tom Lane <tgl@sss.pgh.pa.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

pgsql-bugs by date:

Previous
From: "B.Z"
Date:
Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
Next
From: Michael Paquier
Date:
Subject: Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x