From: | Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru> |
---|---|
To: | Igor Korot <ikorot01(at)gmail(dot)com> |
Cc: | Christophe Pettus <xof(at)thebuild(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Postgres do not support tinyint? |
Date: | 2025-01-10 09:13:05 |
Message-ID: | 59d067bdcf17bd5a624eb7c736779853@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Igor Korot писал(а) 2025-01-09 02:40:
> Hi, Christopphe,
>
> On Wed, Jan 8, 2025 at 1:34 PM Christophe Pettus <xof(at)thebuild(dot)com>
> wrote:
>>
>>
>>
>> > On Jan 8, 2025, at 11:30, Igor Korot <ikorot01(at)gmail(dot)com> wrote:
>> > There is no boolean - it is 0-4 inclusive.
>>
>> Unless you have somehow gotten PostgreSQL running on an IBM 7070, the
>> range 0-4 can be represented by three binary digits, aka booleans. :-)
>
> The only booleans I know of are 0 and 1. ;-)
>
>>
>> To be serious, though, the situation is:
>>
>> 1. If there are just one or two tinyints, having a tinyint type
>> wouldn't save any space in the row.
>
> No it is not a lot of them.
> So then "smallint" is the best bet, right?
>
> Thank you
>
>> 2. If there are a lot of them, it's worth encoding them into a
>> bitstring.
Hi!
If you really need 1-byte integer, you can use "char" type. Cast it
to/from int.
See comment at the end of the page
https://www.postgresql.org/docs/17/datatype-character.html
--
Best regards,
Vladlen Popolitov.
From | Date | Subject | |
---|---|---|---|
Next Message | Dominique Devienne | 2025-01-10 09:41:12 | Re: Postgres do not support tinyint? |
Previous Message | Laurenz Albe | 2025-01-10 08:05:47 | Re: Parameter - shared_memory_size |