snippetsqlMinor
How to export a table on postgresql command line
Viewed 0 times
postgresqllineexporthowcommandtable
Problem
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)
and then
only want one table to then do a restore =D thanks
(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 | postgresonly want one table to then do a restore =D thanks
Solution
If you want to create text files containing the data, use the COPY command (or the
If you want to create SQL statements use pg_dump
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
Context
StackExchange Database Administrators Q#17006, answer score: 8
Revisions (0)
No revisions yet.