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

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Christian Hofmann <christian(dot)hofmann(at)gmx(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME
Date: 2005-10-31 15:24:02
Message-ID: 20051031152402.GA89911@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Kevin Crenshaw 2005-10-31 18:11:27 Re: Problem inserting a row containing GUIDs
Previous Message Christian Hofmann 2005-10-31 11:04:17 Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME