Re: Examples of using bytea type

Поиск
Список
Период
Сортировка
От lbayuk@mindspring.com (ljb)
Тема Re: Examples of using bytea type
Дата
Msg-id 9j82t9$9ts$1@news.tht.net
обсуждение исходный текст
Ответ на Examples of using bytea type  ("Richard Church" <rfchurch@hotmail.com>)
Ответы Re: Re: Examples of using bytea type  (Alex Pilosov <alex@pilosoft.com>)
Список pgsql-general
rfchurch@hotmail.com wrote:
>
>The current PostgreSQL documentation is does not discuss the bytea type at
>all.
>
>Does anyone have indepth examples of using this type in SQL?
>
>I know expressing BLOb data in SQL is awkward and would generate huge text
>files, but is there a standard method of using escape sequences to express
>blobs or something similar to MIME?
>
>There surely must be something like that.

The bytea type is undocumented, so I suppose you should use it at your
own risk, since it may vanish (like lztext did at 7.1).

Keep in mind that unless you use binary cursors, what you get back from a
query on a bytea type is a string with "\nnn" sequences mixed with text in
it, which your application would then need to decode to get the actual
data.  For inserting, you must convert your data to \nnn sequences (\\000
for 0), all in one string, to use in an insert on a bytea (there are no
binary cursors for insert). So it's a lot of trouble, and might not be
worth the effort. If you have to encode/decode in your application anyway,
I wonder if it wouldn't be be easier to do Base64 or Ascii85 coding and use
the "text" type in PostgreSQL instead of bytea?

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: many tables in db
Следующее
От: Justin Clift
Дата:
Сообщение: Re: Interesting discussion