diff options
author | Dmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com> | 2022-07-01 11:10:58 +0300 |
---|---|---|
committer | Dmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com> | 2022-07-01 11:10:58 +0300 |
commit | 097f57194625ce93d0fd563e71055d2a2c1c10eb (patch) | |
tree | b09712bdddfb9ca581eb09c089da088316c6fd2c /create | |
parent | 2916c3e8b1ffcc2abfd54cac7ca0e5c2f579d031 (diff) |
.......... [DEV-2097] various script fixes
Diffstat (limited to 'create')
-rwxr-xr-x | create/bin/gen_history_pk.pl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/create/bin/gen_history_pk.pl b/create/bin/gen_history_pk.pl index b8e2b94e600..0cc1a1c8ef2 100755 --- a/create/bin/gen_history_pk.pl +++ b/create/bin/gen_history_pk.pl @@ -180,12 +180,14 @@ DO $$ DECLARE tsdb_version_major INTEGER; chunk_tm_interval INTEGER; + jobid INTEGER; BEGIN SELECT substring(extversion, '^\d+') INTO tsdb_version_major FROM pg_extension WHERE extname='timescaledb'; IF (tsdb_version_major < 2) THEN - SELECT (upper(ranges[1]) - lower(ranges[1])) INTO chunk_tm_interval FROM chunk_relation_size('history_uint_old') LIMIT 1; + SELECT (upper(ranges[1]) - lower(ranges[1])) INTO chunk_tm_interval FROM chunk_relation_size('%HISTTBL') + ORDER BY ranges DESC LIMIT 1; IF NOT FOUND THEN chunk_tm_interval = 86400; |