From: | Vineet Deodhar <vineet(dot)deodhar(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: moving from MySQL to pgsql |
Date: | 2012-10-11 06:07:31 |
Message-ID: | CAP5=7opLfXqzHwjwOGTetFCUMmCBcici5bgi2qYAOXKSu88Oaw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Oct 11, 2012 at 5:26 AM, Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>wrote:
> Hi,
>
> On 10 October 2012 19:47, Vineet Deodhar <vineet(dot)deodhar(at)gmail(dot)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 )
> )
>
>
Yes. Considering the storage requirements , I am looking for TINYINT kind
of data type.
> if you care about storage then "char" (yes, with quotes) might be the
> right type for you.
>
>> --
>> Ondrej Ivanic
>> (ondrej(dot)ivanic(at)gmail(dot)com)
>> (http://www.linkedin.com/in/ondrejivanic)
>>
>
>
If I use "char" for numeric field, would it be possible to do numeric
operations comparisons such as max(tint_unsigned) ?
--- Vineet
From | Date | Subject | |
---|---|---|---|
Next Message | tigran2-postgres | 2012-10-11 06:14:42 | Storing large files in multiple schemas: BLOB or BYTEA |
Previous Message | Craig Ringer | 2012-10-11 05:56:08 | Re: Storing large files in multiple schemas: BLOB or BYTEA |