Re: Converting MySQL tinyint to PostgreSQL

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Joe <svn(at)freedomcircle(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting MySQL tinyint to PostgreSQL
Date: 2005-07-12 14:30:10
Message-ID: 20050712143010.GA11315@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 12, 2005 at 01:16:07AM -0400, Joe wrote:
> I have a MySQL database that I'm converting to PostgreSQL which has 10
> columns with TINYINT type, i.e., a one-byte integer. Only one of them
> qualifies as a true BOOLEAN. Two are entity identifiers (for limited range
> "classes" or "categories") and three others are "type"/code values. The
> last four are month numbers or day of month numbers (not implemented as
> date types because the year is separate and is part of the primary key).

Just to broaden your choices, there is also a "char" datatype (quotes
included! If you omit them, it's a different thing, more overhead),
which you can use to store a single byte. Could be used as a poor man's
ENUM. Add appropiate CHECK constraints and it could be good enough for
some purposes. Not useful for months, but maybe for your categories or
classes.

There are some usages of this in the system catalogs (e.g.
pg_class.relkind)

--
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
www.google.com: interfaz de línea de comando para la web.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Esposito 2005-07-12 14:34:02 Re: index bloat
Previous Message Dawid Kuroczko 2005-07-12 14:25:26 Re: Converting MySQL tinyint to PostgreSQL