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

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: bz(at)mailinator(dot)com, PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
Date: 2015-06-15 18:34:18
Message-ID: alpine.DEB.2.10.1506152026520.26470@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2015-06-15 19:30:07 Re: BUG #13443: master will remove dead rows when hot standby(use slot) disconnect
Previous Message Jeff Janes 2015-06-15 17:36:30 Re: BUG #13444: psql can't recover a pg_dump.