know the schema name in a trigger

Started by danilo.juvinaoover 18 years ago4 messagesgeneral
Jump to latest
#1danilo.juvinao
danilo.juvinao@gmail.com

Hello,

i want know how can i get the schema name that execute a trigger.

for example, if a have a schema "myschema" and a table "mytable" and
it have a trigger procedure, i want know inside the trigger procedure,
with plpgsql, the shcema name "myschema"..

thanks,

pd. sorry for my english, i'm from Colombia.

#2Tomasz Myrta
jasiek@klaster.net
In reply to: danilo.juvinao (#1)
Re: know the schema name in a trigger

danilo.juvinao napisal 2008-01-12 01:18:

Hello,

i want know how can i get the schema name that execute a trigger.

for example, if a have a schema "myschema" and a table "mytable" and
it have a trigger procedure, i want know inside the trigger procedure,
with plpgsql, the shcema name "myschema"..

Did you try function current_schema() ?

--
Regards,
Tomasz Myrta

#3danilo.juvinao
danilo.juvinao@gmail.com
In reply to: danilo.juvinao (#1)
Re: know the schema name in a trigger

I did try it but always get "public".

i want get the schema that execute the trigger, because i have a
function that is used by diferents tables in diferents schemas.

thanks for your help,
Danilo

#4Laurenz Albe
laurenz.albe@cybertec.at
In reply to: danilo.juvinao (#1)
Re: know the schema name in a trigger

danilo.juvinao wrote:

i want know how can i get the schema name that execute a trigger.

for example, if a have a schema "myschema" and a table "mytable" and
it have a trigger procedure, i want know inside the trigger procedure,
with plpgsql, the shcema name "myschema"..

http://www.postgresql.org/docs/current/static/plpgsql-trigger.html

See TG_TABLE_SCHEMA.

Yours,
Laurenz Albe