balderdashy / waterline-sequel

A SQL generator for use in Waterline Adapters
MIT License
16 stars 61 forks source link

Wrong IN query for postgresql #97

Closed konstantinzolotarev closed 8 years ago

konstantinzolotarev commented 8 years ago

I have a model:

ArrayModel: Waterline.Collection.extend({
    identity: 'arraymodel',
    connection: 'edgetests',
    dynamicFinders: false,
    associationFinders: false,

    attributes: {
     // ....
      tags: {
        type: 'array',
        defaultsTo: []
      }
    }
  }),

Try to fetch all records containing 1 in tags. They exist in DB. Using query:

orm.arraymodel.find({
        tags: [1]
      })

Getting this error:

SELECT "arraymodel"."tags",  "arraymodel"."id", "arraymodel"."createdAt", "arraymodel"."updatedAt"  FROM  "arraymodel" AS "arraymodel"  WHERE "arraymodel"."tags" IN (1)  - malformed array literal: "1"

Using this adapter: https://github.com/waterlinejs/postgresql-adapter

Issue not in it. because it passes all params to this lib here: https://github.com/waterlinejs/postgresql-adapter/blob/master/lib/adapter.js#L407

sailsbot commented 8 years ago

@konstantinzolotarev 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!

sailsbot commented 8 years ago

@konstantinzolotarev,@sailsbot: 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!