0

I want to add some data from a postgresql table to a text file. But already some data is present in the file. I do not want to delete that data. Is it possible? The questions asked earlier were the one in which the table name was dynamic. But in mine, it is not. All I am asking for is to append data. Also, the answer given is for Unix, not windows.

4
  • The questions asked earlier were the one in which the table name was dynamic. But in mine, it is not. All I am asking for is to append data. Also, the answer given is for Unix, not windows.
    – suvrat
    Commented Oct 18, 2019 at 9:10
  • This answer uses a hardcoded table name and will work on Windows as well (if you use a cat version for Windows, probably works with type as well)
    – user1822
    Commented Oct 18, 2019 at 9:28
  • @a_horse_with_no_name I used this command - COPY TEST TO PROGRAM 'cat >>D:\pg_hbaOriginalModified.conf' and got the following error - 'ERROR: program "cat >>D:\pg_hbaOriginalModified.conf" failed DETAIL: child process exited with exit code 1 SQL state: 38000' Can you help with what does this mean?
    – suvrat
    Commented Oct 18, 2019 at 12:10
  • @a_horse_with_no_name One more thing, if my target file contains some comments, and then has the data in a tabular form, is it possible to preserve those comments in the file too.
    – suvrat
    Commented Oct 18, 2019 at 12:36

0

Browse other questions tagged or ask your own question.