Closed mast closed 5 years ago
@mast Thanks for posting, we'll take a look as soon as possible. In the meantime, if you haven’t already, please carefully read the issue contribution guidelines and double-check for any missing information above. In particular, please ensure that this issue is about a stability or performance bug with a documented feature; and make sure you’ve included detailed instructions on how to reproduce the bug from a clean install. Finally, don’t forget to include the version of Node.js you tested with, as well as your version of Sails or Waterline, and of any relevant standalone adapters/generators/hooks.
Thank you!
It seems like sails-mysql is not throwing if a mysql error occurs in a populated query. It just returns empty arrays. I guess at least this one should be treated as critical bug since it's returning wrong data. It's the same in #325.
@mast,@sailsbot,@jelhan: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
Problem description
populate()
returns empty array of child objects in ONE-to-MANY association.Following mysql scheme is used (2 mysql tables):
Following data is added into database:
ModelA description:
ModelB description:
In case if I try to retrieve ModelA by
a_id
set inwhere
clause, all works fine andpopulate()
returns correct array:But if I try to select several ModelA objects,
populate()
returns empty arrays:If I try to execute produced SQL query manually, it returns error, that's why arrays are empty.
As you can see adapter selects several columns with the same name.
Environment
Sails is not used. Waterline 0.12.2 sails-mysql 0.12.2 NodeJS v5.12.0
Full code is available here
https://github.com/mast/sails-mysql-populate-bug
To install it, run
npm install
, and import database fromdb.sql
. You should also change passwords inindex.js