pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: bz@mailinator.com, PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
Date: Mon, 15 Jun 2015 20:34:18 +0200 (CEST)
Message-ID: <alpine.DEB.2.10.1506152026520.26470@sto> (raw)
In-Reply-To: <42501.1434389175@sss.pgh.pa.us>
References: <20150614155912.2732.93270@wrigleys.postgresql.org>
	<42501.1434389175@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (26+ messages)  latest in thread

Message-ID: <alpine.DEB.2.10.1506152026520.26470@sto>
Permalink:  ../alpine.DEB.2.10.1506152026520.26470@sto/
Also on:    postgresql.org/message-id/alpine.DEB.2.10.1506152026520.26470@sto

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: coelho@cri.ensmp.fr, tgl@sss.pgh.pa.us
  Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
  In-Reply-To: <alpine.DEB.2.10.1506152026520.26470@sto>
  References: <20150614155912.2732.93270@wrigleys.postgresql.org> <42501.1434389175@sss.pgh.pa.us> <alpine.DEB.2.10.1506152026520.26470@sto>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox