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

Postgres: Timestamps are modified when saving other fields. #38

Open
wnortje opened this issue Sep 24, 2015 · 3 comments
Open

Postgres: Timestamps are modified when saving other fields. #38

wnortje opened this issue Sep 24, 2015 · 3 comments
Assignees
Labels

Comments

@wnortje
Copy link
Contributor

wnortje commented Sep 24, 2015

When a timestamp field gets a value during record creation it also contains the microseconds

2015-09-23 13:28:49.562436

If the record is then read from the db via (single) and another field is changed and then the record is saved again, the timestamp field now contains this

2015-09-23 13:28:49

without the microseconds.

@eudoxia0 eudoxia0 added the bug label Nov 1, 2015
@eudoxia0
Copy link
Owner

eudoxia0 commented Jan 7, 2016

I suppose this is a precision mismatch between local-time and Postgres. Is there a Postgres option for specifying the precision of timestamps?

@eudoxia0 eudoxia0 self-assigned this Jan 7, 2016
@wnortje
Copy link
Contributor Author

wnortje commented Jan 8, 2016

There may be a precision mismatch but I don't think that is what is causing the problem here. I think it is a conversion problem. Both the values I mention above are extracted from the table at different times.

The first value is created by local-time and stored in the DB. The change in accuracy happens when that records is read from the DB, modified and then saved

@intertricity
Copy link

I'm not entirely sure if this will help, but the postmodern site seemed to make a particular point about timestamps so I thought I'd relay it here- I was looking around for ORM's and this one looked really nice.

https://github.com/marijnh/Postmodern#caveats-and-to-dos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants