I'm trying to make a query in javascript with node.js but nothing happens..
Here is the following query: "COPY tag_7z8eq73 to STDOUT WITH CSV HEADER"
It is working with psql, I can see the full table in result in the terminal of the psql shell.
Here is the function that i'm calling when I click on a button :
async function exportDatabase(req, res){
return db.any("COPY tag_7z8eq73 to STDOUT WITH CSV HEADER")
.then(rows => {
res.json(rows)
})
.catch(error => {
console.log(error)
}); }
I guess I'm supposed to see something in the debug console of my code editor (here VScode) but there is nothing that happens.
Anyone have an idea ?
最后,我没有使用复杂的“COPY TO”命令行,而是“选择”数据库,将其推送到数组中,将其转换为 json 并使用“vue-json-to-csv”插件创建一个 csv 文件。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.