Re: Move rows from one database to other

From: Thomas Güttler <guettliml(at)thomas-guettler(dot)de>
To: Leknín Řepánek <godzilalalala(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Move rows from one database to other
Date: 2017-02-23 15:26:27
Message-ID: 95241ec8-4900-7eef-7dbe-c868c5ce20d5@thomas-guettler.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am 23.02.2017 um 13:44 schrieb Leknín Řepánek:
> Maybe you can do something like
>
> WITH cte AS (
> DELETE FROM t1 WHERE cond
> RETURNINIG *
> )
> INSERT into t2
> SELECT * FROM cte;
>
> To move rows between tables with combination with fdw_postgres and
> foreign table.

... this way you don't need the second table ... nice.

--
Thomas Guettler http://www.thomas-guettler.de/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ertan Küçükoğlu 2017-02-23 15:26:31 Re: Latest PostgreSQL on Raspbian Jessie - solved
Previous Message Thomas Güttler 2017-02-23 15:25:13 Re: Move rows from one database to other