-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Inserting null or empty string values to timestamp column in postgres causes error #2290
Comments
Ok, after more digging I have found out, that problem is in empty string - null works as expected. So in my case it is enough to deal with empty strings where necessary on my side before using repository.update(). Database logging was little bit confusing though. As it shows same output for null and for empty string input: null: |
okay we can do it. Feel free to PR. |
Invalide date also trigger this bug! |
I caught a strange error today.
|
Found same bug with '' and 'Invalid Date' from moment() |
Any updates here? I ran into this bug today. |
Yeah, it should get fixed. It is should be matter of adding an if. |
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[x ]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
TypeORM version:
[ ]
latest
[x]
@next
[ ]
0.x.x
(or put your version here)I have experienced exactly same issue as in issue #1015. I am not able to use
update
orsave
with null or empty string value for timestamp in postgres. Getting this error:error: { error: invalid input syntax for type timestamp: "0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN"
I may have found the cause. There is method
mixedDateToDate
insrc/util/DateUtils.ts
which is converting value to date. But it will try to convert empty string to date as well ending withundefined
date.Shouldn't there be check for empty string and then return empty string or null? I am still not sure I understand that code correctly. But with that check it works for my use case when I need to nullify some value in database.
Can I push pull request with this fix?
The text was updated successfully, but these errors were encountered: