From 94608f692b562e0bded95db38c9084502cc69946 Mon Sep 17 00:00:00 2001 From: Miguel Fernandez Date: Wed, 16 Jun 2021 12:03:43 +0200 Subject: [PATCH] Support populating foreign tables in Postgres Foreign data wrappers allow for querying schemas defined in external systems from within Postgres. This commit adds support for populating foreign tables in Postgres, motivated by the need for populating a clickhouse schema accessed through a particular foreign data wrapper --- sql.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql.go b/sql.go index 424b22a..cae7f2e 100755 --- a/sql.go +++ b/sql.go @@ -112,6 +112,10 @@ WHERE c.relkind IN ( 'r', '' ) AND n.nspname !~ '^gp_toolkit' AND c.relkind = 'r' %s +UNION +SELECT foreign_table_schema as SCHEMA, + foreign_table_name as table +FROM information_schema.foreign_tables ORDER BY 1 ` // add where clause