Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4ZDJ-0006hT-1T for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Jun 2015 18:34:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z4ZDH-0008CB-Ut for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Jun 2015 18:34:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z4ZDH-0008Bf-0h for pgsql-bugs@postgresql.org; Mon, 15 Jun 2015 18:34:27 +0000 Received: from boipeva.ensmp.fr ([194.214.158.101]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Z4ZDE-0003cd-6R for pgsql-bugs@postgresql.org; Mon, 15 Jun 2015 18:34:26 +0000 Received: from cri.ensmp.fr (204.200.219.88.rev.sfr.net [88.219.200.204]) (authenticated bits=0) by boipeva.ensmp.fr (8.15.1/8.14.9/JMMC-22/Oct/2013) with ESMTPSA id t5FIYI4M015185 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Jun 2015 20:34:19 +0200 Date: Mon, 15 Jun 2015 20:34:18 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@sto To: Tom Lane cc: bz@mailinator.com, PostgreSQL Bugs List Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text In-Reply-To: <42501.1434389175@sss.pgh.pa.us> Message-ID: References: <20150614155912.2732.93270@wrigleys.postgresql.org> <42501.1434389175@sss.pgh.pa.us> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at boipeva.ensmp.fr with ID 557F1AAA.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 557F1AAA.000 from 204.200.219.88.rev.sfr.net/204.200.219.88.rev.sfr.net/88.219.200.204/cri.ensmp.fr/ X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org >> 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