Import data.
--- a/postgres.rst Tue Dec 18 13:06:09 2018 +0200
+++ b/postgres.rst Tue Dec 18 13:06:21 2018 +0200
@@ -14,8 +14,8 @@
$ sudo apt-get install postgresql postgresql-client
$ sudo su - postgres
% psql
- postgres=# CREATE USER "mypguser" WITH PASSWORD 'mypguserpass';
- postgres=# CREATE DATABASE "mypgdatabase" OWNER "mypguser";
+ postgres=# CREATE USER myuser WITH PASSWORD 'mypass';
+ postgres=# CREATE DATABASE mydb OWNER myuser;
postgres=# \q
Connect as user ``mypguser`` to new database::
@@ -192,3 +192,13 @@
\copy (SELECT * FROM foo) TO '/tmp/my.csv' WITH CSV
+Import data
+===========
+
+Import CSV file::
+
+ \copy tbl_name from 'my.csv' csv;
+ \copy tbl_name from 'my.csv' delimiter ':' csv;
+
+ $ psql -U $USER -h $HOST $DB -c "\\copy tbl_name from 'my.csv' csv"
+