2

Anyone can do tell me how to do that?

(I know maybe is a dumb question but I'm trying to learn how to use command line of postgresql)

~$ psql mybase
psql (9.1.3)
Type "help" for help.

and then

mybase=# \dt



            List of relations
 Schema |        Name         | Type  |  Owner   
--------+---------------------+-------+----------
 public | xxxxxx              | table | postgres
 public | xxxxxxx             | table | postgres
 public | xxxxxxxxxxx         | table | postgres
 public | xxxxxxxx            | table | postgres
 public | xxxxxxxxx           | table | postgres
 public | xxxxxxxxx           | table | postgres
 public | xxxxxxxxxxxxxxxx    | table | postgres
 public | xxxxxxxxxxxx        | table | postgres
 public | xxxxxxxxxxxxxxxx    | table | postgres
 public | xxxxxxxxxx          | table | postgres
 public | xxxxxxxxx           | table | postgres
 public | xxxxxxxxxxxxxxxx    | table | postgres
 public | xxxxxxxx            | table | postgres

only want one table to then do a restore =D thanks

7

If you want to create text files containing the data, use the COPY command (or the psql command \copy which creates the output files on the client, rather than on the server as the COPY command does).

If you want to create SQL statements use pg_dump

  • 1
    like pg_dump <mybase> -t <atable> -f testride.sql right? – maniat1k Apr 25 '12 at 13:40
  • 2
    @maniat1k: Right. If you have multiple tables of the same name, you would additionally provide the schema -n <myschema> to avoid confusion. – Erwin Brandstetter Apr 25 '12 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.