From d246c9bf33fb7ada19a31a7dbdac32a89f221731 Mon Sep 17 00:00:00 2001 From: Ske Date: Sat, 13 Jun 2020 01:54:29 +0200 Subject: [PATCH] Change HID function types to char(5) as in DB --- PluralKit.Core/Database/Functions/functions.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PluralKit.Core/Database/Functions/functions.sql b/PluralKit.Core/Database/Functions/functions.sql index 1be8aaa3..568d07b1 100644 --- a/PluralKit.Core/Database/Functions/functions.sql +++ b/PluralKit.Core/Database/Functions/functions.sql @@ -84,13 +84,13 @@ as $$ $$ language sql stable rows 10; -create function generate_hid() returns text as $$ +create function generate_hid() returns char(5) as $$ select string_agg(substr('abcdefghijklmnopqrstuvwxyz', ceil(random() * 26)::integer, 1), '') from generate_series(1, 5) $$ language sql volatile; -create function find_free_system_hid() returns text as $$ -declare new_hid text; +create function find_free_system_hid() returns char(5) as $$ +declare new_hid char(5); begin loop new_hid := generate_hid(); @@ -100,8 +100,8 @@ end $$ language plpgsql volatile; -create function find_free_member_hid() returns text as $$ -declare new_hid text; +create function find_free_member_hid() returns char(5) as $$ +declare new_hid char(5); begin loop new_hid := generate_hid();