Re: Inserting a record into another table ... inside a schema

From: John DeSoi <desoi(at)pgedit(dot)com>
To: "Paul Newman" <pnewman(at)tripoint(dot)co(dot)uk>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inserting a record into another table ... inside a schema
Date: 2005-05-05 14:34:25
Message-ID: C7BCA047-BD72-11D9-8E98-000A95B03262@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 5, 2005, at 8:32 AM, Paul Newman wrote:

> I have a public schema with all my tables in it.
>
> I also have a schema for each company that uses our system .. so 300
> companies = 300 schemas. One of the tables has a trigger that is
> trying to insert/update another table that is inside the same schema.
> So far so good. However when I update the base table in schema
> “MySchema” the trigger tries to insert/update a record in the public
> schema and not the “Current” schema (ie the schema of the original
> table). Is there a system variable for “Current Schema” ? …. If not
> what is the best way to achieve this ?

You want search_path -- see

http://www.postgresql.org/docs/8.0/interactive/ddl-schemas.html#DDL-
SCHEMAS-PATH

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Wilson 2005-05-05 14:35:27 Slony v. DBMirror
Previous Message Robert Treat 2005-05-05 14:28:50 Re: [GENERAL] Interesting article on transactional algorithms includes