BUG #15353: \det (list foreign tables) ignoring search_path

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: maxim(dot)boguk(at)gmail(dot)com
Subject: BUG #15353: \det (list foreign tables) ignoring search_path
Date: 2018-08-25 21:09:38
Message-ID: 153523137867.1487.3492770600528164072@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15353
Logged by: Maksym Boguk
Email address: maxim(dot)boguk(at)gmail(dot)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;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2018-08-25 21:44:24 Re: BUG #15353: \det (list foreign tables) ignoring search_path
Previous Message Andrew Gierth 2018-08-25 17:12:58 Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 is not in select list"