Re: Copy Data between different databases

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tim Semmelhaack <semmelhaack(at)gmx(dot)de>, pgsql-general(at)postgresql(dot)org
Subject: Re: Copy Data between different databases
Date: 2015-03-03 15:44:48
Message-ID: 54F5D6F0.2040109@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/03/2015 06:18 AM, Tim Semmelhaack wrote:
> Hi,
>
> I want to copy data between two servers (Version 9.1 and 9.4)
>
> I've tried
>
> psql -h host1 -U user1 -d db1 -f /q1.sql | psql -h host2 -U user2 -d db2 -f
> /q2.sql
>
> Both sql-scripts include the COPY (SELECT ...) TO STDOUT or COPY (SELECT
> ...) TO STDIN
> As a result nothing is copied.
>
> When I run a much simpler version of the query with the -c "Select .."
> option it works. Because the sql-scripts are quite long, I don't to do it
> without the -f option.

Have you tried?:

psql -h host1 -U user1 -d db1 < /q1.sql | psql -h host2 -U user2 -d db2
< /q2.sql

>
> So where is the difference between the -c and the -f option?
>
> Tim
> -- Semmelhaack(at)gmx(dot).de
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kai Groner 2015-03-03 16:15:43 Re: EXCLUDE constraint with not equals
Previous Message Adrian Klaver 2015-03-03 14:51:38 Re: