23 lines
613 B
MySQL
23 lines
613 B
MySQL
|
-- Deploy camper:zero_pad to pg
|
||
|
-- requires: roles
|
||
|
-- requires: schema_camper
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
create or replace function zero_pad(data bytea, block_len integer) returns bytea as
|
||
|
$$
|
||
|
select data || decode(lpad('', ((block_len - (octet_length(data) % block_len)) % block_len) * 2, '0'), 'hex');
|
||
|
$$
|
||
|
language sql
|
||
|
immutable
|
||
|
;
|
||
|
|
||
|
revoke execute on function zero_pad(bytea, integer) from public;
|
||
|
grant execute on function zero_pad(bytea, integer) to guest;
|
||
|
grant execute on function zero_pad(bytea, integer) to employee;
|
||
|
grant execute on function zero_pad(bytea, integer) to admin;
|
||
|
|
||
|
commit;
|