Re: Importing a CSV file to a table on Postgres - Mailing list pgsql-novice

From Phillip Smith
Subject Re: Importing a CSV file to a table on Postgres
Date
Msg-id 1178282609.4760.11.camel@fukawi2.homelinux.net
Whole thread Raw
In response to Re: Importing a CSV file to a table on Postgres  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Responses Re: Importing a CSV file to a table on Postgres  ("Oliveiros Cristina" <oliveiros.cristina@gmail.com>)
List pgsql-novice
I'm not familiar with PGAdmin, but with console you can use a way like
this to insert the contents of a CSV-file into a database table on a
remote host:

cat <file.csv> | ssh <host> "psql -U <user> <database> -c 'copy <table> from stdin;'"

You can do the same from pgAdmin, you just need to upload the file to the server first, then do something like:
    COPY table1 FROM '/tmp/file1.txt';

Remember to write the path as the SERVER will see it, not as the client sees it!

*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email.

Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments

pgsql-novice by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Importing a CSV file to a table on Postgres
Next
From: "Mario Peshev"
Date:
Subject: Export SELECT statement as SQL queries in file