Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: Default execution_time for main policy (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
yevgenypats committed Jul 22, 2022
1 parent 865e1c6 commit f8f0590
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions policies/policy.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
\set ON_ERROR_STOP on
SET TIME ZONE 'UTC';
-- trick to set execution_time if not already set
-- neat trick to set execution_time if not already set
-- https://stackoverflow.com/questions/32582600/only-set-variable-in-psql-script-if-not-specified-on-the-command-line
\set execution_time '2022-07-20 16:16:30.298982+00'
\set execution_time :execution_time
SELECT CASE
WHEN :'execution_time' = '2022-07-20 16:16:30.298982+00'
THEN now()
WHEN :'execution_time' = ':execution_time' THEN to_char(now(), 'YYYY-MM-dd HH24:MI:SS.US')
ELSE :'execution_time'
END AS "execution_time" \gset
\ir cis_v1.2.0/policy.sql
Expand Down

0 comments on commit f8f0590

Please sign in to comment.