From: | khoff <koff10(at)hotmail(dot)com> |
---|---|
To: | Ron <ronljohnsonjr(at)gmail(dot)com> |
Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: bash or sql script to copy foreign table to locale table |
Date: | 2022-05-20 09:40:03 |
Message-ID: | PAXP193MB1533ABC190D3F84DEE56FBAECAD39@PAXP193MB1533.EURP193.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers pgsql-admin |
Hi Ron,
It works
Thanks for your contribution
khoff.
Le 20/05/2022 à 05:17, Ron a écrit :
> Please do not hijack existing threads.
>
> On 5/19/22 18:55, koff wrote:
>> Hi all,
>>
>> I need little help please,
>>
>> I'v already foreign tables (from oracle_fdw) in my postgresql
>> environment.
>>
>> I'm Just looking for script shell or sql ( easy way) to migrate
>> this foreign tables to locale table .
>>
>> My script below has some issue
>>
>> thanks lot
>>
>> ------script migrate---
>>
>> #!/bin/bash
>> export PGDATA=/pg01/pgdata/9.6/data
>> export PGUSER="postgres"
>> export PGPORT="5433"
>> export PGPASSWORD="ttooe2"
>>
>> for tbl in `psql -qAt data_2020 -c "select foreign_table_name
>> from information_schema.foreign_tables;"`;
>> do
> ## note the added semicolon
>> psql data_2020 -c "create table public.\"$tbl\" as select * from
>> fdw_link.\"$tbl\";"
> Here, either psql COPY the fdw_link.\"$tbl\" data OUT to a local file,
> and then COPY IN to public.\"$tbl\" *OR* INSERT INTO public.\"$tbl\"
> SELECT * FROM fdw_link.\"$tbl\";
>
>> done
>>
>> ----end of script---
>>
>> the database is : data_2020
>>
>> foreign_table schema is : fdw_link
>>
>> and want to copy to public schema
>>
>>
>>
>>
>>
>>
>
> --
> Angular momentum makes the world go 'round.
From | Date | Subject | |
---|---|---|---|
Next Message | Akshay Joshi | 2022-05-23 07:56:46 | pgAdmin 4 commit: Ensure that Dashboard graphs should be refreshed on c |
Previous Message | Ron | 2022-05-20 03:17:58 | Re: bash or sql script to copy foreign table to locale table |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Bergmann | 2022-05-20 14:03:38 | Many databases ou many schemas |
Previous Message | Laurenz Albe | 2022-05-20 07:12:12 | Re: Locks under the hood on re-mat and dropping triggers |