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

Reference.update doesn't check all values for changes properly #463

Closed
jrchudy opened this issue Jul 24, 2017 · 3 comments · Fixed by #1006
Closed

Reference.update doesn't check all values for changes properly #463

jrchudy opened this issue Jul 24, 2017 · 3 comments · Fixed by #1006
Assignees
Labels

Comments

@jrchudy
Copy link
Member

jrchudy commented Jul 24, 2017

When the column is of type date, timestamp, or timestamptz, the check to make sure the values have changed before adding the column name to the list of projections may not work properly.

When I saw this issue, I had a timestamp column with:

  • old value = 2016-01-18T13:00:00
  • new value = 2016-01-18T13:00:00.000-08:00

The timestamptz column had these values:

  • old value = 2016-01-18T00:00:00-08:00
  • new value = 2016-01-18T00:00:00.000-08:00

One way to fix this is to convert values for these column types using moment and then compare the values.

@hongsudt
Copy link
Contributor

hongsudt commented Mar 1, 2018

@jrchudy Is this still an issue?

@RFSH RFSH closed this as completed Mar 2, 2018
@RFSH RFSH reopened this Mar 2, 2018
@jrchudy
Copy link
Member Author

jrchudy commented Mar 2, 2018

This is still the case and should be addressed to prevent losing precision for timestamp values.

@RFSH
Copy link
Member

RFSH commented Apr 5, 2023

Since the check in update function is a simple old != new, it will also not properly handle cases where the user's timezone differs from the server's. This is not causing any data loss but will trigger an unnecessary update.

For example, assume the server is in Log Angeles, and the user is in New York. In this case, the entity API would return the timestamptz values like 2023-02-02T11:00:00-8:00, but since we're converting this time to be based on the user's timezone, the submitted data without any change would be 2023-02-02T7:00:00-4:00.

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

Successfully merging a pull request may close this issue.

3 participants