Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

304
Views
A relative path is not allowed to use COPY to a file

I made a function so that when I click on a button it made a "COPY TO" querie to the server. The goal is to export a table database in .csv that goes to the user downloads of my application. I first tried to write the database table in an existing file with the following querie :

async function exportDatabase(req, res){
return db.any("\copy tag_7z8eq73 to 'C:\Users\New-rFid-Concept\Documents\BioTech_mathis\tag_7z8eq73.csv' delimiters '|' CSV HEADER")
.then(rows => {
        res.json(rows)
    })
    .catch(error => {
        console.log(error)
    });   

}

But the following error is returning : "A relative path is not allowed to use COPY to a file"

From what I understand I have to write to STDOUT but when I send this request nothing happens in my VScode terminal or anything else.

I tried :

"COPY tag_7z8eq73 TO STDOUT csv header"

"COPY tag_7z8eq73 TO STDOUT"

"\copy tag_7z8eq73 TO STDOUT"

and others..

Do you know what would be the query that would allow me to create a .csv file with my node.js application?

Thank you for your help!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!