bash or sql script to copy foreign table to locale table

From: koff <koff10(at)hotmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: bash or sql script to copy foreign table to locale table
Date: 2022-05-19 23:55:06
Message-ID: PAXP193MB15339A6E149E3CB509AD2827CAD09@PAXP193MB1533.EURP193.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers pgsql-admin

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 psql data_2020  -c "create table public.\"$tbl\" as 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

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Ron 2022-05-20 03:17:58 Re: bash or sql script to copy foreign table to locale table
Previous Message Aditya Toshniwal 2022-05-19 10:46:16 Re: [pgAdmin][RM-7347]:Improve color scheme for Authentication type in properties for server

Browse pgsql-admin by date

  From Date Subject
Next Message Ron 2022-05-20 03:17:58 Re: bash or sql script to copy foreign table to locale table
Previous Message Wells Oliver 2022-05-19 21:37:47 Locks under the hood on re-mat and dropping triggers