sql first refactor
Some checks failed
CI and deploy / migration-check (push) Successful in 5s
CI and deploy / deploy (push) Failing after 20s

This commit is contained in:
Dusan Vojacek
2026-04-19 20:02:20 +02:00
parent a02e11ee13
commit 93f883f5e0
74 changed files with 6022 additions and 4014 deletions

View File

@@ -0,0 +1,17 @@
-- pack reg 6264 (Europe/Prague wall time, seconds = 0) stejně jako _deye_system_time_register_rows
create or replace function ems.fn_deye_pack_system_time(p_ts timestamptz)
returns int[]
language sql
stable
as $fn$
with loc as (
select (p_ts at time zone 'Europe/Prague') as t
)
select array[
((extract(year from t)::int - 2000) << 8) | extract(month from t)::int,
(extract(day from t)::int << 8) | extract(hour from t)::int,
(extract(minute from t)::int << 8) | 0
]
from loc;
$fn$;