Re: pg_tables and temp tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pg_tables and temp tables
Дата
Msg-id 6282.1194883534@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pg_tables and temp tables  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Список pgsql-general
"Gauthier, Dave" <dave.gauthier@intel.com> writes:
> How user specific is pg_tables when it comes to temporary tables?

regression=# \d pg_tables
...
View definition:
 SELECT n.nspname AS schemaname, c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, t.spcname AS
tablespace,c.relhasindex AS hasindexes, c.relhasrules AS hasrules, c.reltriggers > 0 AS hastriggers 
   FROM pg_class c
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
   LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace
  WHERE c.relkind = 'r'::"char";

Not at all, apparently.  This looks to me like it will pick up every
table in the database, temporary or otherwise.  Perhaps that's not a
good idea ...

> I can live with this as long as there's a way that I can determine if
> the table it found does not belong to the current session.

You need to pay attention to the schema it was found in.
"has_schema_privilege(schemaname, 'USAGE')" might be a suitable filter.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: Filter tables
Следующее
От: Erik Jones
Дата:
Сообщение: Re: Filter tables