duplicating tables (accross databases) - Mailing list pgsql-general

From Jim Martinez
Subject duplicating tables (accross databases)
Date
Msg-id Pine.LNX.4.33.0201101544210.907-100000@unagi.e-techservices.com
Whole thread Raw
In response to Re: duplicating table  ("Campano, Troy" <Troy.Campano@LibertyMutual.com>)
List pgsql-general
> I know this will seem silly, but I'm trying to
> make a copy of a table with a few modifications.

A variation on the above:

Suppose I create and populate a table called people in the test database
and I want to move it to another database called production.  How can a
query across the schema?  And schema may not be the correct word.

For simplicity, suppose people is created (in both test and
production) using:

create table people (fname varchar(20), lname varchar(20));

I want to do something like
insert into production.people
  select fname, lname from test.people;

Actually I'd be connected to the production instance so I really want to
try:

insert into people
  select fname, lname from test.people;

An archive search yielded nothing, though maybe I searched with not the
best keyword (schema).

Any points, comments welcome.

Thanks in advance,
Jim Martinez


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: index and seq scan
Next
From: Tom Lane
Date:
Subject: Re: Insert Performance with WAL and Fsync