Обсуждение: Feature Request: Multi-octet raw

Поиск
Список
Период
Сортировка

Feature Request: Multi-octet raw

От
Trent Shipley
Дата:
It would be nice if Postgresql supported multi-octet raw data.  Certainly a 
lot of what you would do with it would be similar to bytea, but the basic 
string functions would be overloaded so that the unit of work would be a 
multi-octet word.  

Multi-octet instances could be cast to bytea when one wanted to work with the 
data bit-by-bit instead of word-by-word.

the declaration would be something like:

CREATE TABLE acme( ...  ,multi_octet_foo  MULTIOCTET (octets-per-word, max-words-per-column) ,...)

To reuse a declaration you could create a domain.


MULTIOCTET columns could be loaded using octal, decimal, or hexadecimal text 
input. 


The real advantage of a multi-octet type would be for power users.  The code 
would be reusable.  It would simplify tasks like creating the often requested 
native support for UTF-16 and the less frequently requested UTF-32.


Re: Feature Request: Multi-octet raw

От
Martijn van Oosterhout
Дата:
On Tue, Dec 06, 2005 at 08:54:42PM -0700, Trent Shipley wrote:
> It would be nice if Postgresql supported multi-octet raw data.  Certainly a
> lot of what you would do with it would be similar to bytea, but the basic
> string functions would be overloaded so that the unit of work would be a
> multi-octet word.

Well, PostgreSQL allows you to create your own types so you could just
make one that does what you want. The only tricky part would be the
syntax on creation because user-defined types can't take parameters.
OTOH, maybe by the time someone writes the code for such a type the
details will have been worked out.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.