Hello
I saw this questions : https://github.com/vitaly-t/pg-promise/issues/90 but in my case I'm wondering how I can generate simple query like :
REFRESH MATERIALIZED VIEW CONCURRENTLY ${tableName}; ?
I have an array of table names (5). I'm not in the case of an insert
I tried something like :
return db.tx(function (t) {
let batchQueries = [];
event.tables_names.forEach(function(tableName) {
batchQueries.push(t.none(`REFRESH MATERIALIZED VIEW CONCURRENTLY ${tableName};`));
});
return t.batch(batchQueries);
})
return db.tx(function (t) {
var queries = event.tables_names.map(function (name) {
return t.none(`REFRESH MATERIALIZED VIEW CONCURRENTLY $1~`, name);
});
return t.batch(queries);
});
Thanks a lot again @vitaly-t for the fast and correct answer. 馃帀