From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: maxim.boguk@gmail.com
Subject: BUG #15353: \det (list foreign tables) ignoring search_path
Date: Sat, 25 Aug 2018 21:09:38 +0000
Message-ID: <153523137867.1487.3492770600528164072@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15353
Logged by: Maksym Boguk
Email address: maxim.boguk@gmail.com
PostgreSQL version: 9.6.8
Operating system: Linux
Description:
Hi,
Looks like that the \det[+] [PATTERN] list foreign tables
ignoring current searh_path settings:
postgres=# \det+
List of foreign tables
Schema | Table | Server | FDW Options | Description
--------+-------+--------+-------------+-------------
(0 rows)
postgres=# show search_path ;
search_path
-----------------
"$user", public
(1 row)
postgres=# \det+ public.*
List of foreign tables
Schema | Table | Server | FDW Options
| Description
--------+---------------------+--------+--------------------------------------------------------------+-------------
public | pg_stat_user_tables | test | (schema_name 'pg_catalog',
table_name 'pg_stat_user_tables') |
(1 row)
Look like that there are problem with pg_catalog.pg_table_is_visible(c.oid)
for foreign tables because query
postgres=# SELECT n.nspname AS "Schema",
c.relname AS "Table",
s.srvname AS "Server"
FROM pg_catalog.pg_foreign_table ft
INNER JOIN pg_catalog.pg_class c ON c.oid = ft.ftrelid
INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
INNER JOIN pg_catalog.pg_foreign_server s ON s.oid = ft.ftserver
--WHERE pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1, 2;
Schema | Table | Server
--------+---------------------+--------
public | pg_stat_user_tables | test
work without issues.
PS: initialization of test case:
\c postgres
create extension IF NOT EXISTS postgres_fdw;
CREATE SERVER test FOREIGN DATA WRAPPER postgres_fdw OPTIONS (
dbname 'postgres',
use_remote_estimate 'true'
);
CREATE USER MAPPING FOR public SERVER test OPTIONS (
"user" 'postgres'
);
IMPORT FOREIGN SCHEMA pg_catalog
LIMIT TO (pg_stat_user_tables)
FROM SERVER test
INTO public;
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, maxim.boguk@gmail.com
Subject: Re: BUG #15353: \det (list foreign tables) ignoring search_path
In-Reply-To: <153523137867.1487.3492770600528164072@wrigleys.postgresql.org>
References: <153523137867.1487.3492770600528164072@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox