foreign_table_exposer 1.0.0

This Release
foreign_table_exposer 1.0.0
Date
Status
Stable
Abstract
Expose foreign tables as a regular table
Description
PostgreSQL extension which exposes foreign tables as a regular table.
Released By
komamitsu
License
Apache 2.0
Resources
Special Files
Tags

Extensions

foreign_table_exposer 1.0.0
Expose foreign tables as a regular table

README

foreign_table_exposer

This PostgreSQL extension exposes foreign tables like a normal table with rewriting Query tree. Some BI tools can't detect foreign tables since they don't consider them when getting table list from pg_catalog.pg_class. With this extension those BI tools can detect foreign tables as well as normal tables.

Installation

$ make
$ sudo make install

Setup

Write this line in your postgresql.conf and then restart PostgreSQL.

shared_preload_libraries = 'foreign_table_exposer'

Execute this statement when you want to enable this feature.

CREATE EXTENSION foreign_table_exposer;

Usage

When you scan pg_catalog.pg_class with a predicate like relkind in ('r', 'v'), this extension automatically rewrites the query to include 'f' (foreign table).

postgres=#
  select
    relname, nspname, relkind
  from
    pg_catalog.pg_class c,
    pg_catalog.pg_namespace n
  where relkind in ('r', 'v') and
    nspname not in ('pg_catalog', 'information_schema', 'pg_toast', 'pg_temp_1') and
    n.oid = relnamespace order by nspname, relname;

     relname      | nspname | relkind
------------------+---------+---------
  normal_tbl      | public  | r
  foreign_tbl     | public  | f
  example_view    | public  | v
  (3 rows)