0.1.alpha-32 invalid syntax for integer. .findBy new functionality error with relations
See original GitHub issue.find* methods now have keyof for entity for fields, but passing relation entity fully gives db-level error. Passing id (as it worked in 0.0.11 version of typeorm) gives typescript compiler error that it’s supposed to be entity but not integer.
working:
0.0.11
await em.findOne(Post, {
user: user.id,
productName
});
but 0.1.alpha-32 same code does not compile, since find options are now keyof Entity
If I pass whole entity db dies with “invalid syntax integer” since it tries to use whole object in select.
Maybe I did not catch up with new functionality of some kind?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
PG COPY error: invalid input syntax for integer - Stack Overflow
ERROR : invalid input syntax for integer: "". "" isn't a valid integer. PostgreSQL accepts unquoted blank fields as null by default in...
Read more >Search an integer array fails, invalid syntax for integer #2495
I am referencing JSON / Array issue #442 RN - 65 Node - 14 Express - 4.1 I have a very simple PG...
Read more >Re: ERROR: invalid input syntax for integer - PostgreSQL
If a geometry is NULL, the st_distance_sphere postgis function returned NULL. NULL/1000 = NULL. round(NULL) = NULL. AND NULL < 150 = NULL....
Read more >InvalidTextRepresentation: invalid input syntax for integer
While doing a GET operation on /query , Trac issued an internal error. We have a custom field duedate: [ticket-custom] duedate = time...
Read more >7 ERROR: invalid input syntax for integer - Laracasts
Problem with postgresql 'where' function SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: A simple query. Copy Code
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
no, not finding by relation. I told you to add a new column called
userId
, like this:and relation will use this column (and create FK for this). It will work since their names match. Plus you can use it in findOptions
@pleerock I actually thought it is designed and going to stay - column name as entity name without id postfixed and in database as key.
0.0.11 version
About your suggestion - this is interesting approach, but will 0.1 version support
?
Right now typeorm does not convert user entity object to it’s id so sql will be valid.
Wait a minute. I misread your post. You mean findBy is not actually supposed to work with relations, yes? Finding by relations.