Re: functions - triggers cross schemas

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Armand Pirvu (home)" <armand(dot)pirvu(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: functions - triggers cross schemas
Date: 2016-10-13 22:31:26
Message-ID: CAKFQuwaJuuge+NRg0eeJjcShN90qPDQk=4xst-FuSmxPRCqeeg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 13, 2016 at 3:18 PM, Armand Pirvu (home) <armand(dot)pirvu(at)gmail(dot)com
> wrote:

> 2 schemas , schema1 and schema2, with same tables , a base table and a
> tracking one.
>
>
> Search path is set to schema1 by default.
> insert into schema2.test1 (col2 , col3) values ('foo1','foo2')
> I get an entry in schema1.test1_hist and not in schema2.test1_hist
>

​See:

https://www.postgresql.org/docs/current/static/plpgsql-trigger.html#PLPGSQL-DML-TRIGGER


TG_TABLE_SCHEMA

​Any object name not schema qualified will use search_path for resolution.
Search path doesn't change upon entering a function unless the function
defines its own - and your's does not.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Armand Pirvu (home) 2016-10-13 23:44:41 Re: functions - triggers cross schemas
Previous Message Thomas Munro 2016-10-13 22:26:21 Re: SERIALIZABLE and INSERTs with multiple VALUES