Re: moving from MySQL to pgsql

Поиск
Список
Период
Сортировка
От Ondrej Ivanič
Тема Re: moving from MySQL to pgsql
Дата
Msg-id CAM6mie+FkqobH22KWJNxCTMFpvgeO4M4Ju2p5jD_F_ffibVhyw@mail.gmail.com
обсуждение исходный текст
Ответ на moving from MySQL to pgsql  (Vineet Deodhar <vineet.deodhar@gmail.com>)
Ответы Re: moving from MySQL to pgsql  (Vineet Deodhar <vineet.deodhar@gmail.com>)
Список pgsql-general
Hi,

On 10 October 2012 19:47, Vineet Deodhar <vineet.deodhar@gmail.com> wrote:
> 3) Can I simulate MySQL's TINYINT data-type (using maybe the custom data
> type or something else)

What do you exactly mean? Do you care about storage requirements or
constraints? The smallest numeric type in postgres is smallint: range
is +/- 32K and you need two bytes. You can use check constraint to
restrict the range (postgres doesn't have signed / unsigned types):

create table T (
  tint_signed smallint check ( tint_signed >= -128 and tint_signed =< 127 ),
  tint_unsigned smallint check ( tint_unsigned >= 0 and tint_unsigned =< 255 )
)

if you care about storage then "char" (yes, with quotes) might be the
right type for you.

--
Ondrej Ivanic
(ondrej.ivanic@gmail.com)
(http://www.linkedin.com/in/ondrejivanic)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Planner chooses multi-column index in 9.2 when maybe it should not
Следующее
От: Darren Duncan
Дата:
Сообщение: Re: moving from MySQL to pgsql