>> regression=# select '9791020902573'::isbn = '10-209-0257-4'::isbn;
>> f
>> beginning with 979 to a ISBN10 should have raised an exception.
> Making the second query return true makes the system internally consistent
> too...but doesn't actually provide the correct answer (again, I trust)
Yes.
On third thoughs, the above query should raise an exception because the
cast is illegal, 979* is not an ISBN, so the answer is neither true nor
false. The query should be simply written to use the larger type and not
cast to the subtype.
SELECT EAN13 '9791234567896' = ISBN '123456789X'; -- False
SELECT EAN13 '9781234567897' = ISBN '123456789X'; -- True
--
Fabien.