Re: Porting MySQL data types to PostgreSQL

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: Porting MySQL data types to PostgreSQL
Дата
Msg-id 1185473171.10167.28.camel@dogma.ljc.laika.com
обсуждение исходный текст
Ответ на Porting MySQL data types to PostgreSQL  ("Gautam Sampathkumar" <gsampathkumar@gmail.com>)
Ответы Re: Porting MySQL data types to PostgreSQL  (Jim Nasby <decibel@decibel.org>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Kaloyan Iliev
Дата:
Сообщение: NOTICE Acepted as Error After Upgrade
Следующее
От: Tom Lane
Дата:
Сообщение: Re: The database slows down after a few weeks