Re: Is there a reason why Postgres doesn't have Byte or tinyint?

Поиск
Список
Период
Сортировка
От Darren Duncan
Тема Re: Is there a reason why Postgres doesn't have Byte or tinyint?
Дата
Msg-id 4F09473C.7080802@darrenduncan.net
обсуждение исходный текст
Ответ на Re: Is there a reason why Postgres doesn't have Byte or tinyint?  (Mike Christensen <mike@kitchenpc.com>)
Ответы Re: Is there a reason why Postgres doesn't have Byte or tinyint?  (Scott Marlowe <scott.marlowe@gmail.com>)
Список pgsql-general
Mike Christensen wrote:
>>> According to the manuals, Postgres has smallint (2 byte), integer (4
>>> bytes) and bigint (8 bytes)..  I use a lot of structures with "bytes"
>>> in my code and it's kinda annoying to cast DB output from Int16 to
>>> Byte every time, especially since there's no explicit cast in .NET and
>>> you have to use System.Convert().
>>>
>>> Is there a work-around, or do people just cast or use Int16 in their
>>> data structures?  Just wondering..  I know on modern computers it
>>> probably doesn't make any difference anyway..
>>
>> Is this just about programmer convenience or is it about space efficiency in
>> the database?  BYTEA might help you.  Or try declaring a DOMAIN over
>> SMALLINT that limits allowed values to the range of a byte. -- Darren Duncan
>
> This is purely programmer convenience.
>
> Basically, I want Npgsql to marshal the value as a .NET Byte type, if
> I can find a way to do that I'm happy.  Perhaps it's more of a Npgsql
> question, though I'm curious as to why Postgres doesn't have an
> intrinsic tinyint or byte type.

Maybe Postgres doesn't need a Byte type predefined because it gives you the
means to define the type yourself, such as using DOMAIN.

Generally speaking, I believe it is more important for a type system to provide
the means for arbitrary user-defined types which can be used in all the places
as built-in-defined types, than to have large numbers of built-in-defined types.

-- Darren Duncan

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

Предыдущее
От: Mike Christensen
Дата:
Сообщение: Re: Is there a reason why Postgres doesn't have Byte or tinyint?
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Is there a reason why Postgres doesn't have Byte or tinyint?