Skip site navigation (1) Skip section navigation (2)

Copy rows returned from a view into a table in a different db

From: Russell Christopher <russch(at)hotmail(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Copy rows returned from a view into a table in a different db
Date: 2011-11-05 17:55:48
Message-ID: SNT127-DS7FF87D624E554F355CC14C3DB0@phx.gbl (view raw or flat)
Thread:
Lists: pgsql-novice
Complete PostgreSQL newb here.

 

I have 7-8 views worth of data in db1 that I need to copy into tables with
matching schemae (schemas?) in a different database. The destination
database may be the same instance of postgresql, or one on a different box
altogether. 

 

I know 2-3 different ways to accomplish this with the databases I'm familiar
with, but I'm helpless on this one. Can someone suggest some basic
strategies for me? 

 

In a perfect world, I'd prefer not to have to do anything that feels too
ETL-ish - I'd rather do some sort of SELECT FROM instance1.db1.viewname INTO
instance2.db5.tablename then dump data out of the view as text file and
reload into the destination table. I see postgresql has a COPY command, and
that' the sort of thing I want to avoid if I can.

 

Since I don't know postgreSQL, so I don't really know what is within the
realm of possibility, though.

 

Thanks!

 

Responses

pgsql-novice by date

Next:From: Jean-Yves F. BarbierDate: 2011-11-05 23:19:52
Subject: function error
Previous:From: Jean-Yves F. BarbierDate: 2011-11-05 14:31:48
Subject: Global variables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group