Fix: Ensure iso_time uses user TZ when tz_override is empty #2106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
In pl/pgsql function
iso_time
, convertgvmd.tz_override
to NULL when it is the empty string.Why
This ensures that the user's timezone setting is used (instead of always UTC).
This has two effects:
time o m m '<get_info type="nvt" filter="sort-reverse=created rows=10 first=1000"/>' > /tmp/info
After:
<creation_time>2023-03-31T11:52:43+02:00</creation_time>
Before:
<creation_time>2023-03-31T09:52:43Z</creation_time>
iso_time
is much fasterSELECT iso_time (creation_time), iso_time (modification_time) FROM nvts ORDER BY creation_time DESC LIMIT 10 OFFSET 85940;
Before: 11s
After: 3s
In particular this means the GSA SecInfo > NVTs page is much faster when using the pager arrows (going to the end page was 11s and is now 4s for me).
Why is it faster? The broken
coalesce
was causing the empty string to be passed as zone toiso_time(seconds, zone)
. I think this was causing the exception to be thrown (and caught), slowing things down.