Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME
Дата
Msg-id 20051031104613.GA18878@webserv.wug-glas.de
обсуждение исходный текст
Ответ на PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME  ("Christian Hofmann" <christian.hofmann@gmx.de>)
Ответы Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME  ("Christian Hofmann" <christian.hofmann@gmx.de>)
Список pgsql-novice
am  31.10.2005, um 10:47:50 +0100 mailte Christian Hofmann folgendes:
> Hello,
>
> while my trigger is fired, I can access the variable "TG_RELNAME" to get the
> name of the table that is updated.
> How will I get the name of the shema this table is stored?

You have the TG_RELNAME:

SELECT nspname FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relname = TG_RELNAME;


>
> Thank you,

Thanks to itsMe_ in #postgresql ;-)
(IRC-Channel)

11:32 < akretschmer> Hi, i have a table-oid and need to know the schema-name. What can i do?
11:43 < itsMe_> akretschmer: SELECT nspname FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE
c.relname= 
                'tablename';



HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

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

Предыдущее
От: "Christian Hofmann"
Дата:
Сообщение: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME
Следующее
От: "Christian Hofmann"
Дата:
Сообщение: Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME