public inbox for [email protected]
help / color / mirror / Atom feedFrom: koff <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: bash or sql script to copy foreign table to locale table
Date: Fri, 20 May 2022 01:55:06 +0200
Message-ID: <PAXP193MB15339A6E149E3CB509AD2827CAD09@PAXP193MB1533.EURP193.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <MW4PR17MB4513397D5F05F0013DDDC150ABEC9@MW4PR17MB4513.namprd17.prod.outlook.com>
References: <MW4PR17MB4513FBC690156566FB0E5A17ABED9@MW4PR17MB4513.namprd17.prod.outlook.com>
<CAMa=N=NBvJv9vtCPz67a4jEP57ioVJwfTvscKXpA3JNidC-pKw@mail.gmail.com>
<MW4PR17MB4513397D5F05F0013DDDC150ABEC9@MW4PR17MB4513.namprd17.prod.outlook.com>
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
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: bash or sql script to copy foreign table to locale table
In-Reply-To: <PAXP193MB15339A6E149E3CB509AD2827CAD09@PAXP193MB1533.EURP193.PROD.OUTLOOK.COM>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox