Обсуждение: save to another database

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

save to another database

От
First Last
Дата:
how do i save the result of a query into a new table in another database? the IN database doesn't seem to work for in
postgresql;
"SELECT * INTO newtable IN newdatabase FROM mytable";

_____________________________________________________________
Check out Atenista.Net (www.atenista.net)- new design, regular content and additional services!

Re: save to another database

От
"A. Kretschmer"
Дата:
am  19.01.2006, um 22:07:38 -0800 mailte First Last folgendes:

Good morning, First Last,

> how do i save the result of a query into a new table in another database? the IN database doesn't seem to work for in
postgresql;
> "SELECT * INTO newtable IN newdatabase FROM mytable";

Impossible.

Solutions:

- use dblink from contrib
  http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/dblink/
  http://pgfoundry.org/projects/dblink-tds/

- save the result in a table, create a dump from this table with
  pg_dump, open the other database, restore the dump.
  You can do this steps in a shell-script.


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===