public inbox for [email protected]
help / color / mirror / Atom feedFrom: Vladlen Popolitov <[email protected]>
To: Igor Korot <[email protected]>
Cc: Christophe Pettus <[email protected]>
Cc: David G. Johnston <[email protected]>
Cc: Ron Johnson <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: Postgres do not support tinyint?
Date: Fri, 10 Jan 2025 16:13:05 +0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+FnnTyxnWjjaC4dDo6Y4DeCYAVa3dgGdsMg3sdTOFiyHAG7Ag@mail.gmail.com>
References: <CA+FnnTzfvgVdptHcLBFPrq_Q+xPes-Bhjiw_xFiooq4VqhqyrQ@mail.gmail.com>
<CANzqJaCxZK0j8fL-riZpX+AV+kyo9PcAvgF=H5DgaWK+C+66Vw@mail.gmail.com>
<CAKFQuwYYgPxUSvo2UzOty5Cd1xw5+2q1bg3+zY-nsXNZyq+_4g@mail.gmail.com>
<[email protected]>
<CA+FnnTxf3VxTPzGFy7q-6ENVcV769F_5_=nbGOvK40qua8XPgg@mail.gmail.com>
<[email protected]>
<CA+FnnTyxnWjjaC4dDo6Y4DeCYAVa3dgGdsMg3sdTOFiyHAG7Ag@mail.gmail.com>
Igor Korot писал(а) 2025-01-09 02:40:
> Hi, Christopphe,
>
> On Wed, Jan 8, 2025 at 1:34 PM Christophe Pettus <[email protected]>
> wrote:
>>
>>
>>
>> > On Jan 8, 2025, at 11:30, Igor Korot <[email protected]> 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.
view thread (7+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Postgres do not support tinyint?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox