pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15353: \det (list foreign tables) ignoring search_path
2+ messages / 2 participants
[nested] [flat]

* BUG #15353: \det (list foreign tables) ignoring search_path
@ 2018-08-25 21:09 PG Bug reporting form <noreply@postgresql.org>
  2018-08-25 21:44 ` Re: BUG #15353: \det (list foreign tables) ignoring search_path Andrew Gierth <andrew@tao11.riddles.org.uk>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2018-08-25 21:09 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: maxim.boguk@gmail.com

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;



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #15353: \det (list foreign tables) ignoring search_path
  2018-08-25 21:09 BUG #15353: \det (list foreign tables) ignoring search_path PG Bug reporting form <noreply@postgresql.org>
@ 2018-08-25 21:44 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
  0 siblings, 0 replies; 2+ messages in thread

From: Andrew Gierth @ 2018-08-25 21:44 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; maxim.boguk@gmail.com

>>>>> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:

 PG> Looks like that the   \det[+] [PATTERN]      list foreign tables
 PG> ignoring current searh_path settings:

Nope, what you're missing is that pg_catalog is implicitly on the front
of the search path (if not otherwise specified), so
pg_catalog.pg_stat_user_tables is considered to "hide"
public.pg_stat_user_tables. Object X in schema Y is only considered
"visible" if using the unqualified name "X" actually resolves to the Y.X
object, and in this case, if one just refers to "pg_stat_user_tables"
one gets pg_catalog.pg_stat_user_tables, not public.pg_stat_user_tables.

-- 
Andrew (irc:RhodiumToad)




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-08-25 21:44 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-08-25 21:09 BUG #15353: \det (list foreign tables) ignoring search_path PG Bug reporting form <noreply@postgresql.org>
2018-08-25 21:44 ` Andrew Gierth <andrew@tao11.riddles.org.uk>

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