Skip to content
Snippets Groups Projects
Commit 2e472ef7 authored by Anton Bagliy's avatar Anton Bagliy
Browse files

ADD: misc scripts #389

parent a7ddf842
Branches issue389_remote_sendrates issue389_tasks
No related merge requests found
-- https://redbyte.eu/en/blog/transliteration-in-postgresql/
CREATE OR REPLACE FUNCTION cyrillic_transliterate(p_string text)
RETURNS character varying AS
$BODY$
SELECT replace(replace(replace(replace(
replace(replace(replace(replace(translate(lower($1),
'абвгдеёзийклмнопрстуфхцэы',
'abvgdeezijklmnoprstufхcey'), 'ж',
'zh'),
'ч', 'ch'), 'ш', 'sh'), 'щ', 'shh'), 'ъ', ''), 'ю',
'yu'), 'я', 'ya'), 'ь', '');
$BODY$
LANGUAGE SQL IMMUTABLE
COST 100;
insert into tasks (name, recordbookid, disciplineid, modulenumber, "open")
(select 'CodeGenerator2' "name", "RecordBookID", 22353 "disciplineid", 14 "modulenumber", true "open"
from discipline_getstudents(22353));
insert into nicknames(name, accountid, servicename)
(select cyrillic_transliterate("LastName") "name",
accounts.id,
'github' "servicename"
from discipline_getstudents(22353)
join students on students.id = "ID"
join accounts on students.accountid = accounts.id)
--select "RecordBookID", cyrillic_transliterate("LastName") from discipline_getstudents(22353)
select *
from discipline_getstudents(22353)
-- disciplineid 22353
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment