Обсуждение: Dragging and dropping tables between databases

Поиск
Список
Период
Сортировка

Dragging and dropping tables between databases

От
John Gage
Дата:
Okay, maybe not that simple, but is there a way to transfer a table
easily between two databases?

The easiest way I can think of is to back-up the table in an sql file
and then run the sql file in the other database.  Is that the easiest?

I guess I should sign this, Homer Simpson.

Thanks,

John Gage

Re: Dragging and dropping tables between databases

От
"A. Kretschmer"
Дата:
In response to John Gage :
> Okay, maybe not that simple, but is there a way to transfer a table
> easily between two databases?
>
> The easiest way I can think of is to back-up the table in an sql file
> and then run the sql file in the other database.  Is that the easiest?

Yeah, or:

pg_dump | psql

with proper parameters.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

Re: Dragging and dropping tables between databases

От
Sean Davis
Дата:


On Thu, Jun 3, 2010 at 11:29 AM, John Gage <jsmgage@numericable.fr> wrote:
Okay, maybe not that simple, but is there a way to transfer a table
easily between two databases?

The easiest way I can think of is to back-up the table in an sql file
and then run the sql file in the other database.  Is that the easiest?


You could also look at the contrib package dblink.  However, if you are planning on making this part of an application, it should be possible to do this at that level, also.

Sean

Re: Dragging and dropping tables between databases

От
Jasen Betts
Дата:
On 2010-06-03, John Gage <jsmgage@numericable.fr> wrote:
> Okay, maybe not that simple, but is there a way to transfer a table
> easily between two databases?

You mean like a one-off copy?

> The easiest way I can think of is to back-up the table in an sql file
> and then run the sql file in the other database.  Is that the easiest?

pretty-much  pg-dump has other non-sql formats  but at the end of the
day dumping to SQL (and compressing with something if there's a
significant physical distance to cover) is about as good as it gets.


But if you want a read-only copy that's kept mostly up-to-date there are
other solutions.