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.1506200900060.31742@sto
Whole thread Raw
In response to Re: BUG #13442: ISBN doesn't always roundtrip with text  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: BUG #13442: ISBN doesn't always roundtrip with text  (Heikki Linnakangas <hlinnaka@iki.fi>)
List 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.

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #8470: 9.3 locking/subtransaction performance regression
Next
From: y_r_wang@263.net
Date:
Subject: BUG #13455: Start fair