pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: bz@mailinator.com, PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
Date: Tue, 21 Jul 2015 16:17:10 +0200 (CEST)
Message-ID: <alpine.DEB.2.10.1507211608490.30948@sto> (raw)
In-Reply-To: <55AE06AB.4090002@iki.fi>
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>
	<alpine.DEB.2.10.1506200900060.31742@sto>
	<55AE06AB.4090002@iki.fi>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>


Hello Heikki,

>> There is no clear upgrade path from 1.0 to 2.0, as the ISBN "in" function
>> is changed, as well as some casts.  I'm not sure of a safe way to upgrade,
>> because the initial version was accepting invalid ISBN which would now be
>> rejected, thus some store data may be considered corrupted in a database.
>> On the other hand, probably few people would use a legacy ISBN type and
>> put ISBN13 number in them, hopefully? Hmmm...
>
> 10-digit ISBNs are indeed legacy, I don't have much sympathy for an 
> application that still uses the 10-digit isbn datatype in a table. The cast 
> might well be used for display purposes, though. You might do something like 
> "SELECT isbn_column as bisbn13, isbn_column::isbn as isbn FROM ...". So I 
> think your patch is OK, and we should provide an upgrade script, and put a 
> warning in the release notes that you should not be using the 10-digit isbn 
> datatype as a column type anymore.
>
> As long as you don't use the isbn datatype in any tables or views, the 
> upgrade script could just DROP the datatype, and recreate it. It's 
> unfortunate that it won't work if you've used it in a view, but it seems 
> acceptable. Could you write an upgrade script like that, please?

Probably I could. I'll have a look. It has to drop the type *and* some 
casts I think. Should it cascade? Probably not, because people will no 
like loosing their library data:-)

> In the long term, I think we should deprecate all the legacy "short" 
> datatypes, isbn, issn, ismn and upc. As a replacement for display purposes, 
> provide functions to print an ean13 in those legacy forms. I'm not even sure 
> we need the isbn13, issn13 etc. datatypes, to be honest. A single ean13 
> datatype and a function to check if an EAN is an ISBN, ISSN etc. should be 
> enough. You could then use that in a CHECK constraint or create a domain if 
> you really need to. Oh, and get rid of the "weak input mode" while we're at 
> it - that's just horrible.

Hmmm. I like the principle of using a type to embed the constraint check, 
and I*N13 types are fine, only the short types are indeed legacy and have 
an issue.

> Perhaps we should add those functions now, so that you can rewrite your 
> application to use them now, and we could remove the legacy datatypes in a 
> future release.

I do not have an application, I just wrote the patch because I used these 
types some time ago. Also, I'm not sure how to deprecate a type.

-- 
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.1507211608490.30948@sto>
Permalink:  ../alpine.DEB.2.10.1507211608490.30948@sto/
Also on:    postgresql.org/message-id/alpine.DEB.2.10.1507211608490.30948@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, hlinnaka@iki.fi, tgl@sss.pgh.pa.us
  Subject: Re: BUG #13442: ISBN doesn't always roundtrip with text
  In-Reply-To: <alpine.DEB.2.10.1507211608490.30948@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> <alpine.DEB.2.10.1506200900060.31742@sto> <55AE06AB.4090002@iki.fi> <alpine.DEB.2.10.1507211608490.30948@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