Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME
Date
Msg-id 20051031152402.GA89911@winnie.fuhr.org
Whole thread Raw
In response to Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME  ("Christian Hofmann" <christian.hofmann@gmx.de>)
List pgsql-novice
On Mon, Oct 31, 2005 at 12:04:17PM +0100, Christian Hofmann wrote:
> > 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. But when I habe more than one table in different shemas with the
> same name?

Use "WHERE c.oid = TG_RELID" instead of "WHERE c.relname = TG_RELNAME".

--
Michael Fuhr

pgsql-novice by date:

Previous
From: "Christian Hofmann"
Date:
Subject: Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME
Next
From: "Kevin Crenshaw"
Date:
Subject: Re: Problem inserting a row containing GUIDs