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-20 07:04:19
Message-ID: alpine.DEB.2.10.1506200900060.31742@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


>> I think this definitely indicates a bug:
>>
>> regression=# select '9791020902573'::isbn;
>> isbn
>> ---------------
>> 10-209-0257-4
>> (1 row)
>
> Yes, indeed, this one is definitely a bug.

Attached patch makes isn to distinguish when needed between ISBN and
ISBN13. ISBN is the legacy ISBN10 number which is part of ISBN13, but not
all ISBN13 numbers are ISBN.

The initial version was confusing both types, leading to accept valid
ISBN13 number as valid ISBN(10) number although they use the 979 prefix,
hence the reported issues.

The patch also adds some tests.

There is no clear upgrade path from 1.0 to 2.0, as the ISBN "in" function
is changed, as well as some casts. I'm not sure of a safe way to upgrade,
because the initial version was accepting invalid ISBN which would now be
rejected, thus some store data may be considered corrupted in a database.
On the other hand, probably few people would use a legacy ISBN type and
put ISBN13 number in them, hopefully? Hmmm...

--
Fabien.

Attachment Content-Type Size
isn-fix-1.patch text/x-diff 87.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2015-06-21 19:25:20 Re: Incorrect processing of CREATE TRANSFORM with DDL deparding
Previous Message y_r_wang 2015-06-20 05:47:10 BUG #13455: Start fair