Closed edpop closed 7 years ago
Hello.
I tried to aggregate a simple table: { id: serial, id_state: integer } myModel.aggregate(["id_state"]).max("id").as("my_name").groupBy("id_state")
{ id: serial, id_state: integer }
myModel.aggregate(["id_state"]).max("id").as("my_name").groupBy("id_state")
Got error: { "code": "Unknown", "message": "Cannot set property 'alias' of undefined" }
{ "code": "Unknown", "message": "Cannot set property 'alias' of undefined" }
There is a line: https://github.com/dresende/node-orm2/blob/v2.1.30/lib/AggregateFunctions.js#L24 When i removed this, that line began to work correctly: https://github.com/dresende/node-orm2/blob/v2.1.30/lib/AggregateFunctions.js#L71
node -v: v4.2.1 db: postgresql 9.4 orm: 2.1.30
By the way, it would be nice to add "ARRAY_AGG" in https://github.com/dresende/node-orm2/blob/v2.1.30/lib/Drivers/DML/postgres.js#L109. It works fine on my config.
Thank you.
Hello.
I tried to aggregate a simple table:
{ id: serial, id_state: integer }
myModel.aggregate(["id_state"]).max("id").as("my_name").groupBy("id_state")
Got error:
{ "code": "Unknown", "message": "Cannot set property 'alias' of undefined" }
There is a line: https://github.com/dresende/node-orm2/blob/v2.1.30/lib/AggregateFunctions.js#L24 When i removed this, that line began to work correctly: https://github.com/dresende/node-orm2/blob/v2.1.30/lib/AggregateFunctions.js#L71
By the way, it would be nice to add "ARRAY_AGG" in https://github.com/dresende/node-orm2/blob/v2.1.30/lib/Drivers/DML/postgres.js#L109. It works fine on my config.
Thank you.