Solved

copy/transfer postgre table

Posted on 2012-03-26
1
666 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:
Eugene Z 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query Syntax error after > 11 41
compare date to getdate() 8 17
Database-Scoped Permissions 2 17
Not listening to where 1 21
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
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…

749 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