digest as IMMUTABLE function

Поиск
Список
Период
Сортировка
От Mª José Sempere
Тема digest as IMMUTABLE function
Дата
Msg-id 000001c4deb4$7fa9f1e0$0900a8c0@mj
обсуждение исходный текст
Список pgsql-admin
Hello,

We were trying to create an index using the digest function like that (where
picture is a bytea field):

create unique index my_index on my_table digest(picture, 'md5'));

but we got the error:


ERROR:  functions in index expression must be marked IMMUTABLE


So, we have created the function digestinmutable(), like that:

CREATE OR REPLACE FUNCTION digestinmutable(bytea, text)
  RETURNS bytea AS
'$libdir/pgcrypto', 'pg_digest'
  LANGUAGE 'c' IMMUTABLE;


And after that, we have created the index using the new function
(digestinmutable) :


create unique index my_index  on my_table digestinmutable(picture, 'md5'));



IT SEEMS TO WORK OK. Does Anybody know if we'll have any problem using md5
in that way?


Thank you very much for your help.

Bye




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

Предыдущее
От: Ron Peterson
Дата:
Сообщение: fallback authentication
Следующее
От: rray@tcmail.mstc.state.ms.us
Дата:
Сообщение: Login with blank password