How to determine table schema in trigger function - Mailing list pgsql-general

From Andrus
Subject How to determine table schema in trigger function
Date
Msg-id de24k1$7ke$1@news.hub.org
Whole thread Raw
Responses 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>)
List 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 by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Same database, different query plans
Next
From: Gary Fay
Date:
Subject: Startup ...