Skip site navigation (1) Skip section navigation (2)

Re: Importing a CSV file to a table on Postgres

From: Phillip Smith <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Importing a CSV file to a table on Postgres
Date: 2007-05-04 12:43:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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

In response to


pgsql-novice by date

Next:From: Mario PeshevDate: 2007-05-04 13:45:42
Subject: Export SELECT statement as SQL queries in file
Previous:From: A. KretschmerDate: 2007-05-04 12:24:36
Subject: Re: Importing a CSV file to a table on Postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group