Solved

copy/transfer postgre table

Posted on 2012-03-26
1
594 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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Creating and Managing Databases with phpMyAdmin in cPanel.
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now