0

We are using posgrest and wanted to create a function that creates a txt or csv file and wanted to download the file when function is called from rest endpoint. I tried COPY function to generate csv file and hoping to download load the file from rest endpoint.

copy (select * from mytable) to '\tmp\test.csv' with CSV DELIMITER ',';

But the above in the function saying I need to be superuser to write file to the location.

Now I am looking to write a function that generates file in memory and send to rest endpoint.

My question is how would I generate file in memory and later download the file contents via rest endpoint.

balajiu
  • 1
  • 2

0 Answers0