Re: Porting MySQL data types to PostgreSQL

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Gautam Sampathkumar <gsampathkumar(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Porting MySQL data types to PostgreSQL
Date: 2007-07-26 18:06:11
Message-ID: 1185473171.10167.28.camel@dogma.ljc.laika.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2007-07-24 at 10:47 -0700, Gautam Sampathkumar wrote:
> Hi,
> I am in the process of porting a MySQL database to PostgreSQL.
> I was wondering why PostgreSQL does not support unsigned data types?
>
> Does this mean I'd have to essentially double the space occupied by
> most database columns e.g convert mysql integer to postgresql bigint?
>

Most applications don't need an unsigned int, because either the
expected range is within 0-2 billion; or the expected range exceeds 0-4
billion.

Either way, you can use a CHECK (my_attribute >= 0) to enforce the
constraint.

You might want to just check the table to see if there are any values
that exceed 2 billion. If so, you might think about using bigint anyway,
because you don't want to overflow.

If you really do need an unsigned type, this is a good use of
postgresql's extensible type system. You can just create an unsigned
type for yourself.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tony Crisera 2007-07-26 18:22:12 create function error
Previous Message NetComrade 2007-07-26 17:51:31 Question about Postgres