2022-10-26 06:34:36 -04:00
|
|
|
-- Copyright (c) HashiCorp, Inc.
|
|
|
|
|
-- SPDX-License-Identifier: BUSL-1.1
|
2023-02-02 17:15:17 -08:00
|
|
|
|
2021-05-06 14:54:10 -07:00
|
|
|
begin;
|
|
|
|
|
|
2022-10-26 06:34:36 -04:00
|
|
|
-- Comments for the functions below were incorrectly overridden in
|
2022-12-08 12:40:14 -06:00
|
|
|
-- 12/01_timestamp_sub_funcs.up.sql but fixed in 58/01_fix_comments.up.sql.
|
2022-10-26 06:34:36 -04:00
|
|
|
|
2022-08-08 18:17:57 -04:00
|
|
|
create function wt_add_seconds(sec integer, ts timestamp with time zone) returns timestamp with time zone
|
2021-05-06 14:54:10 -07:00
|
|
|
as $$
|
|
|
|
|
select ts + sec * '1 second'::interval;
|
|
|
|
|
$$ language sql
|
|
|
|
|
stable
|
|
|
|
|
returns null on null input;
|
|
|
|
|
comment on function wt_add_seconds is
|
2022-11-15 10:26:26 -08:00
|
|
|
'wt_add_seconds returns ts + sec.';
|
2021-05-06 14:54:10 -07:00
|
|
|
|
2022-08-08 18:17:57 -04:00
|
|
|
create function wt_add_seconds_to_now(sec integer) returns timestamp with time zone
|
2021-05-06 14:54:10 -07:00
|
|
|
as $$
|
|
|
|
|
select wt_add_seconds(sec, current_timestamp);
|
|
|
|
|
$$ language sql
|
|
|
|
|
stable
|
|
|
|
|
returns null on null input;
|
|
|
|
|
comment on function wt_add_seconds_to_now is
|
2022-11-15 10:26:26 -08:00
|
|
|
'wt_add_seconds_to_now returns current_timestamp + sec.';
|
2021-05-06 14:54:10 -07:00
|
|
|
|
|
|
|
|
commit;
|