Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign update timestamps at database level #737

Merged
merged 3 commits into from
Jul 10, 2023
Merged

Conversation

leplatrem
Copy link
Contributor

Follow-up of Graham's comment

@leplatrem leplatrem changed the title Assign timestamps in db Assign update timestamps at database level Jul 6, 2023
@grahamalama
Copy link
Contributor

grahamalama commented Jul 6, 2023

One issue you might run into with these tests:

https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

Since these functions return the start time of the current transaction, their values do not change during the transaction. This is considered a feature: the intent is to allow a single transaction to have a consistent notion of the “current” time, so that multiple modifications within the same transaction bear the same time stamp.

Since we use this method to set up database tests, which wraps the entire test in a database transaction that rolls back when the test is complete, the automatic updating via #723 or even the use of NOW() may not behave as expected in tests.

@leplatrem leplatrem marked this pull request as ready for review July 6, 2023 15:55
@leplatrem leplatrem requested a review from a team as a code owner July 6, 2023 15:55
@leplatrem leplatrem merged commit 865283c into main Jul 10, 2023
@leplatrem leplatrem deleted the assign-timestamps-in-db branch July 10, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants