The following bug has been logged on the website:
Bug reference: 13442
Logged by: B.Z
Email address: bz@mailinator.com
PostgreSQL version: 9.4.4
Operating system: Linux think 4.0.0-1-amd64 #1 SMP Debian 4.0.2-1 (2
Description:
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.
Assuming the isn extension is installed:
CREATE TEMP TABLE t(i isbn);
INSERT INTO t VALUES('9791020902573');
SELECT * FROM t WHERE i = '9791020902573'; -- Returns 10-209-0257-4
SELECT * FROM t WHERE i = '10-209-0257-4'; -- Returns 0 rows
SELECT '9791020902573'::isbn = '10-209-0257-4'::isbn; -- Returns f
Other examples of ISBNs with this behavior:
select isbn from isbns where isbn::isbn != isbn::isbn::text::isbn;
isbn
10-91986-01-0
10-91414-02-5
975891300-X
598687008-5
904072556-X
10-209-0257-4
10-209-0014-8
960838204-1
10-91447-03-9
963208937-5
10-209-0011-3
975297291-8
957849470-X
157607283-5
10-93509-00-7
10-209-0014-8
10-209-0273-6
975574374-X
979984511-4
953173635-9
853390230-1
963930301-1
10-223-0179-9
10-209-0141-1
10-209-0041-5
960218202-4
598340069-X
10-91600-01-5
598340069-X
(29 rows)