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

From: "Christian Hofmann" <christian(dot)hofmann(at)gmx(dot)de>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME
Date: 2005-10-31 11:04:17
Message-ID: 012901c5de0a$d69efcb0$7b00a8c0@CHRISSI
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello Anreas,

> 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?

> 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';

Yes, I will take the table-oid to get the shema name. Thats a better idea.

I thought there were a variable the shema is stored in. So I need an extra
query.

But it is ok.

Thank you,

Christian

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-10-31 15:24:02 Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME
Previous Message A. Kretschmer 2005-10-31 10:46:13 Re: PL/pgSQL Trigger - Variable for shema? Like TG_RELNAME