getodk / getodk/central

Standardise PostgreSQL "current" timestamp usage

Open
#1,216 12 comments 1 reaction 0 assignees View on GitHub
backend refactor
Dominant language
JavaScript
Stars
226
Forks
235
Avg merge
2d 22h
Merged PRs (30d)
19

Description

PostgreSQL offers various functions and variables for accessing the current date/time: https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

In the codebase, 4 variants are used:

```sh
echo &&
echo " count variant" &&
git grep -E '(localtime\w*)|current_date|(current_time\w*)|(\bnow\(\))|(timeofday\(\))|(\w+_timestamp\(\))' |
grep -Fv 'Date.now()' |
grep -Eo '(localtime\w*)|current_date|(current_time\w*)|(\bnow\(\))|(timeofday\(\))|(\w+_timestamp\(\))' |
sort |
uniq --count

count variant
40 clock_timestamp()
5 current_date
2 current_timestamp
42 now()
```

It would be helpful to understand which variant(s) are preferred by default, and why alternatives are used in specific situations.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.