Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4lsD-0002QE-Tx for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Jun 2015 08:05:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Z4lsD-00062S-27 for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Jun 2015 08:05:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Z4lsC-00062L-0s for pgsql-bugs@postgresql.org; Tue, 16 Jun 2015 08:05:32 +0000 Received: from boipeva.ensmp.fr ([194.214.158.101]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Z4ls4-00083V-BG for pgsql-bugs@postgresql.org; Tue, 16 Jun 2015 08:05:30 +0000 Received: from cri.ensmp.fr (nat-any-rnt.cri.ensmp.fr [195.83.117.252]) (authenticated bits=0) by boipeva.ensmp.fr (8.15.1/8.14.9/JMMC-22/Oct/2013) with ESMTPSA id t5G85Gml004737 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Jun 2015 10:05:19 +0200 Date: Tue, 16 Jun 2015 10:05:16 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@sto To: "David G. Johnston" cc: Tom Lane , "bz@mailinator.com" , PostgreSQL Bugs List Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text In-Reply-To: Message-ID: References: <20150614155912.2732.93270@wrigleys.postgresql.org> <42501.1434389175@sss.pgh.pa.us> <598.1434425712@sss.pgh.pa.us> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at boipeva.ensmp.fr with ID 557FD8BC.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 557FD8BC.000 from nat-any-rnt.cri.ensmp.fr/nat-any-rnt.cri.ensmp.fr/195.83.117.252/cri.ensmp.fr/ X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org >> 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. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs