1. 查看外部数据

    [postgres@pg1 ~]$ cat b.txt 

    3,cc

  2. 登陆postgresql数据库

    [postgres@pg1 ~]$ psql -d mydb

  3. 创建表

    mydb=# create table t1 (id int4,name varchar(20));

  4. 导入数据

    mydb=# copy t1 from '/home/postgres/b.txt' (delimiter ',');

  5. 查看数据

    mydb=# select * from t1;