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

Fix bug with insertMany, createdAt, and entity timestamp #1151

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

ktuite
Copy link
Member

@ktuite ktuite commented Jun 6, 2024

I noticed this after adding a property to the Entity frame and then trying to "insertMany" entities.

It's not the createdAt timestamp type that gets rearranged in the insertMany query, it's the last type because indexOf(['createdAt'], Type.insertfields (with the brackets) always returns -1. indexOf('createdAt',... works as intended. Fixing this also led me to fix the typo of timestampz in the Entity frame that wasn't being surfaced before.

What has been done to verify that this works as intended?

Added a new test, which I verified failed before the code change.

Why is this the best possible solution? Were any other approaches considered?

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

I don't think there was previously a scenario to trigger this bug before. It didn't come up if the last type in a Frame was a timestamp, or if the Frame didn't have a createdAt.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@@ -27,7 +27,7 @@ class Entity extends Frame.define(
'int4', 'int4',
'conflictType',
'timestamptz',
'timestamptz', 'timestampz',
'timestamptz', 'timestamptz',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment before the class definition has became obsolete - not by this change though

@ktuite ktuite merged commit 5d1f0ec into master Jun 7, 2024
5 checks passed
@ktuite ktuite deleted the ktuite/insertMany_bug branch June 7, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants