pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: bz@mailinator.com <bz@mailinator.com>
Cc: PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
Date: Tue, 16 Jun 2015 10:05:16 +0200 (CEST)
Message-ID: <alpine.DEB.2.10.1506160958340.4491@sto> (raw)
In-Reply-To: <CAKFQuwYpa7ygEJ-Dih1F0v8010UAS727W=tjbukJK7hhFEJZOg@mail.gmail.com>
References: <20150614155912.2732.93270@wrigleys.postgresql.org>
	<42501.1434389175@sss.pgh.pa.us>
	<alpine.DEB.2.10.1506152026520.26470@sto>
	<598.1434425712@sss.pgh.pa.us>
	<alpine.DEB.2.10.1506160728030.26470@sto>
	<CAKFQuwYpa7ygEJ-Dih1F0v8010UAS727W=tjbukJK7hhFEJZOg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (26+ messages)  latest in thread

Message-ID: <alpine.DEB.2.10.1506160958340.4491@sto>
Permalink:  ../alpine.DEB.2.10.1506160958340.4491@sto/
Also on:    postgresql.org/message-id/alpine.DEB.2.10.1506160958340.4491@sto

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: coelho@cri.ensmp.fr, david.g.johnston@gmail.com, tgl@sss.pgh.pa.us, bz@mailinator.com
  Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
  In-Reply-To: <alpine.DEB.2.10.1506160958340.4491@sto>
  References: <20150614155912.2732.93270@wrigleys.postgresql.org> <42501.1434389175@sss.pgh.pa.us> <alpine.DEB.2.10.1506152026520.26470@sto> <598.1434425712@sss.pgh.pa.us> <alpine.DEB.2.10.1506160728030.26470@sto> <CAKFQuwYpa7ygEJ-Dih1F0v8010UAS727W=tjbukJK7hhFEJZOg@mail.gmail.com> <alpine.DEB.2.10.1506160958340.4491@sto>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox