Re: storing binary data

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: storing binary data
Дата
Msg-id 28942.971752960@sss.pgh.pa.us
обсуждение исходный текст
Ответ на storing binary data  (Neil Conway <nconway@klamath.dyndns.org>)
Ответы Re: storing binary data  (Neil Conway <nconway@klamath.dyndns.org>)
Список pgsql-general
Neil Conway <nconway@klamath.dyndns.org> writes:
> I want to store some binary data in Postgres. The data is an
> MD5 checksum of the user's password, in binary. It will be
> exactly 16 bytes (since it is a one-way hash).

> Can I store this safely in a CHAR column?

No.  CHAR and friends assume there are no null (zero) bytes.
In MULTIBYTE setups there are probably additional constraints.

You could use bytea, but I would recommend converting the checksum
to a hex digit string and then storing that in a char-type field.
Hex is the usual textual representation for MD5 values, no?

            regards, tom lane

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

Предыдущее
От: Neil Conway
Дата:
Сообщение: storing binary data
Следующее
От: Rick Roberts
Дата:
Сообщение: Compiling JDBC Driver