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.1506160958340.4491@sto
Whole thread Raw
In response to Re: BUG #13442: ISBN doesn't always roundtrip with text  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
>>  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.

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #13368: standby cluster immediately promotes after pg_basebackup from previously promoted master
Next
From: 德哥
Date:
Subject: Re: BUG #13443: master will remove dead rows when hot standby(use slot) disconnect