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

From Fabien COELHO
Subject Re: BUG #13442: ISBN doesn't always roundtrip with text
Date
Msg-id alpine.DEB.2.10.1506152026520.26470@sto
Whole thread Raw
In response to Re: BUG #13442: ISBN doesn't always roundtrip with text  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #13442: ISBN doesn't always roundtrip with text  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
>> I have a table containing ISBNs stored as the isbn type provided by the isn
>> extension. In certain cases an ISBN in ISBN10 form is considered unequal to
>> the same ISBN in ISBN13 form.
>
> 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 don't know enough about the whole ISBN/EAN mess to
> understand what this should be doing instead, though.

Hmmm. ISBN-10 -> ISBN-13 is really just adding "978" in front, so there is
no casted ISBN-10 number starting with 979. ISTM that "979" is just a
recorded prefix for books, just as "978", for ISBN-13. AFAICR the prefix
was chosen so that the checksum digit can be kept in the conversion.

   SELECT '9791020902573'::isbn = '10-209-0257-4'::isbn; -- Returns f

Indeed, but this one should return true:

   SELECT '9781020902574'::isbn = '10-209-0257-4'::isbn;

So I would say there is no bug as the number are indeed different, or that
I missed something.

--
Fabien.

pgsql-bugs by date:

Previous
From: Jeff Janes
Date:
Subject: Re: BUG #13444: psql can't recover a pg_dump.
Next
From: "Soule, Cathi (HQP)"
Date:
Subject: Re: BUG #13438: Restore using GUI client - Data Not Loading