Re: How to modify ENUM datatypes?

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, Merlin Moncure <mmoncure(at)gmail(dot)com>, Tino Wildenhain <tino(at)wildenhain(dot)de>, Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
Subject: Re: How to modify ENUM datatypes?
Date: 2008-04-28 21:35:41
Message-ID: 1209418542.14025.73.camel@dogma.ljc.laika.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2008-04-26 at 20:33 -0400, Robert Treat wrote:
> I think one of the best examples of this is the movie rating system (which I
> blogged about at
> http://people.planetpostgresql.org/xzilla/index.php?/archives/320-PostgreSQL-8.3-Features-Enum-Datatype.html
> )
>
> It's a good example of setting pre-defined values that really can leverage the
> enum types custom ordering. It also showcases the idea of data definitions
> that "should never change", but that do changes every half dozen years or so.
> Now you can argue that since it is expected that the ratings might change in
> some way every few years that an enum type is not a good choice for this, but
> I feel like some type of counter-argument is that this is probably longer
> than one would expect thier database software to last. :-)
>

Let's say you have ratings A, B, and D for 5 years, and then you add
rating C between B and D.

If you have a constant stream of movies that must be reviewed, then the
addition of a new rating will necessarily take some fraction of the
movies away from at least one of the old ratings. In that case, is an
old B really equal to a new B?

Similar concerns apply to other changes in ENUMs, and for that matter,
they apply to the FK design, as well.

I would say the *actual* rating is the combination of the rating name,
and the version of the standards under which it was rated.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Viktor Rosenfeld 2008-04-28 21:52:22 Re: passing a temporary table with more than one column to a stored procedure
Previous Message Tino Wildenhain 2008-04-28 19:27:09 Re: How to modify ENUM datatypes?