Re: Find schema-qualified table name given unqualified name

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Find schema-qualified table name given unqualified name
Дата
Msg-id 20576.1529420779@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Find schema-qualified table name given unqualified name  (Aron Widforss <pgsql-general@antarkt.is>)
Список pgsql-general
Aron Widforss <pgsql-general@antarkt.is> writes:
> I'm interested in finding a (any) unique identifier for a table given an unqualified name of the table. Is that
feasiblein SQL or a C function? 

Something like this might help you:

      select relnamespace::regnamespace from pg_class
      where oid = 'mytablename'::regclass;

This will fail (not just return an empty set) if 'mytablename' isn't
resolvable, so you might need some hackery to cope with that.  Also,
if you need it to work pre-9.5, you'll need to write an explicit
join to pg_namespace instead of relying on regnamespace.

            regards, tom lane


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

Предыдущее
От: Aron Widforss
Дата:
Сообщение: Find schema-qualified table name given unqualified name
Следующее
От: Louis Battuello
Дата:
Сообщение: Drop Default Privileges?