Open masitko opened 8 years ago
@masitko in this case what is the outcome when running:
UserLogin.find().sum('count').groupBy('user')
The point of the columnName
is so that the mapping on the backend can perform this for you. You should only use the defined attributes you supply in queries.
@particlebanana This is the query produced by your statement:
SELECT userId as group0, CAST(SUM("userlogin"."count") AS float) AS count FROM "public"."userlogin" AS "userlogin" GROUP BY user
Column was created properly with requested name 'userId' I'm using latest releases of sails-postgresql and waterline-sequel
There is a problem when using PostgreSQL and trying to aggregate and group data by column with custom camel-cased columnName. For an example:
If we try to group users by userId column:
created statement will trigger two errors in PostgreSQL:
as we can see userId is missing required in this case double quotes.