Solved

copy/transfer postgre table

Posted on 2012-03-26
1
655 Views
Last Modified: 2012-04-11
I have a table in a postgreSQL DB I'd like to make an exact copy of and put in another postgreSQL DB. Using the same name, structure—everything identical.

Can anyone help me with the query I should use to do this? How can I expand it to do multiple tables at once?

Thanks!
0
Comment
Question by:hibbsusan
1 Comment
 
LVL 42

Accepted Solution

by:
EugeneZ earned 500 total points
ID: 37770561
use insert into
e.g. code

insert into your table2
select * from table1

more
INSERT
http://www.postgresql.org/docs/8.2/static/sql-insert.html

--

also you may use COPY commund : to copy table data too \from  file
http://www.postgresql.org/docs/8.4/static/sql-copy.html
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question