Re: BUG #13442: ISBN doesn't always roundtrip with text

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "bz(at)mailinator(dot)com" <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-16 08:05:16
Message-ID: alpine.DEB.2.10.1506160958340.4491@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergi Casbas 2015-06-16 08:40:03 Re: BUG #13444: psql can't recover a pg_dump.
Previous Message Michael Paquier 2015-06-16 07:42:02 Re: BUG #13368: standby cluster immediately promotes after pg_basebackup from previously promoted master