You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
I have been using lovefield for a while, but now I am starting to use DATE_TIME columns. I discover that if they are .addIndex()-ed they must be specified explicitly on .insert() - even if made .addNullable(), as an uncaught error occurs. However if the column is not indexed, the error does not occur but they are incorrectly assigned the default value of null, instead of Date(0).
As you can see from test 2, treating a STRING in the same way results in more expected behaviour.
I have tested further without .addNullable() and my tests mostly result in error 202:
Constraint error: (202) Attempted to insert NULL value to non-nullable field deals.[FIELDNAME]
Further testing shows a 202 error is generated for whichever field is not specified, whether STRING, DATE_TIME, INTEGER, NUMBER or BOOLEAN.
However, according to documentation the default value for a DATE_TIME field is Date(0). I presume this to be new Date (0) and not a string representation of the current date/time, and this is borne out by inspecting lf.type .
However observed behaviour suggests that the default values for STRING, DATE_TIME, INTEGER, NUMBER and BOOLEAN are not implemented, because when added with .addNullable() they come out as undefined, and not null.
I have been using lovefield for a while, but now I am starting to use DATE_TIME columns. I discover that if they are .addIndex()-ed they must be specified explicitly on .insert() - even if made .addNullable(), as an uncaught error occurs. However if the column is not indexed, the error does not occur but they are incorrectly assigned the default value of null, instead of Date(0).
Repro: https://plnkr.co/edit/sZ7gGCDpXWrOTpKC
As you can see from test 2, treating a STRING in the same way results in more expected behaviour.
I have tested further without .addNullable() and my tests mostly result in error 202:
Constraint error: (202) Attempted to insert NULL value to non-nullable field deals.[FIELDNAME]
Further testing shows a 202 error is generated for whichever field is not specified, whether STRING, DATE_TIME, INTEGER, NUMBER or BOOLEAN.
However, according to documentation the default value for a DATE_TIME field is Date(0). I presume this to be new Date (0) and not a string representation of the current date/time, and this is borne out by inspecting lf.type .
However observed behaviour suggests that the default values for STRING, DATE_TIME, INTEGER, NUMBER and BOOLEAN are not implemented, because when added with .addNullable() they come out as undefined, and not null.
So I did another test:
https://plnkr.co/edit/4351TPYa7BlSVn7d?preview
...and it appears that the defaults specified in lf.type are not applied at all.
Perhaps that is the root of this issue?
The text was updated successfully, but these errors were encountered: