Fixed PostgreSQL exception, #3585

This commit is contained in:
Ylian Saint-Hilaire 2022-02-02 11:08:03 -08:00
parent 43e4a41792
commit e6d73972a1

2
db.js
View File

@ -1265,7 +1265,7 @@ module.exports.CreateDB = function (parent, func) {
};
obj.GetEventsTimeRange = function (ids, domain, msgids, start, end, func) {
if (ids.indexOf('*') >= 0) {
sqlDbQuery('SELECT doc FROM events WHERE ((domain = $1) AND (time BETWEEN $2 AND ?)) ORDER BY time', [domain, start, end], func);
sqlDbQuery('SELECT doc FROM events WHERE ((domain = $1) AND (time BETWEEN $2 AND $3)) ORDER BY time', [domain, start, end], func);
} else {
sqlDbQuery('SELECT doc FROM events JOIN eventids ON id = fkid WHERE ((domain = $1) AND (target = ANY ($2)) AND (time BETWEEN $3 AND $4)) GROUP BY id ORDER BY time', [domain, ids, start, end], func);
}