-
Notifications
You must be signed in to change notification settings - Fork 209
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
InsertStmt: automatically add insert columns when using InsertStmt.Record() #227
Conversation
…cord() This change automatically adds the insert columns when using InsertStmt.Record() if they are not set by calling Columns(). Calling Columns() afterwards still maintains the same behaviour as it overwrites the Column field. Since there is no API incompatibility, this change was made on the existing Record() function.
there is a bug on changing fields |
Hello @jiyeyuran, can you elaborate on that? |
|
@jiyeyuran the tagstore is intialized on each Record() call with The only "problem" here would be calling Record() multiple times with different struct types for which the initialised columns for the 1st struct would not match the 2nd struct columns. But this "problem" already exists if the provided struct fields don't match the specified Columns() call. There is actually room for improvement if we make the tagstore part of the insert statement and reutilise it for both Record calls and struct validation between calls |
The bug will show if you add test like below:
You also need to ignore the |
No bug version:
|
When calling Record() when no columns are specified, the id field values needs to be checked before inclusion. Thanks @jiyeyuran
@jiyeyuran got it, thanks. I have updated the PR with the suggested changes. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This change automatically adds the insert columns when using
InsertStmt.Record() if they are not set by calling Columns().
Calling Columns() afterwards still maintains the same behaviour as it
overwrites the Column field.
Since there is no API incompatibility, this change was made on the
existing Record() function.