How to determine table schema in trigger function

Поиск
Список
Период
Сортировка
От Andrus
Тема How to determine table schema in trigger function
Дата
Msg-id de24k1$7ke$1@news.hub.org
обсуждение исходный текст
Ответы Re: How to determine table schema in trigger function  (Michael Fuhr <mike@fuhr.org>)
Re: How to determine table schema in trigger function  (Oliver Elphick <olly@bray-healthcare.com>)
Список pgsql-general
I created generic (for tables in different schemas) trigger function :

CREATE OR REPLACE FUNCTION setlastchange() RETURNS "trigger"
AS $$BEGIN
UPDATE serverti SET lastchange='now'  WHERE tablename=TG_RELNAME and
   schemaname=TG_SCHEMA;
RETURN NULL;
END$$  LANGUAGE plpgsql STRICT;


Unfortunately, this does not work since TG_SCHEMA is not valid in PL/pgSQL

How to determine schema name where table TG_RELNAME belongs in trigger
function ?

Andrus.

table structure is:

CREATE TABLE serverti (
  schemaname CHARACTER(7),
  tablename CHARACTER(8) ,
  lastchange timestamp,
  primary key (schemaname, tablename) );



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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Same database, different query plans
Следующее
От: Gary Fay
Дата:
Сообщение: Startup ...