Query specific table using relative position in search path

From: George Woodring <george(dot)woodring(at)iglass(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Query specific table using relative position in search path
Date: 2013-11-08 16:51:35
Message-ID: CACi+J=QBi1Mdw6dBbSz9wrfTU7rA4VPS1br0oWGsM0mb7aWySw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Currently we have a database per customer approach to our database
methodology. In this we have the customer tables in the public schema. We
create restrictions by having views in different schemas and modifying the
search path. (restriction, public).

We are investigating having a scheme of having multiple customers in the
same database and each of them having their own schema ( restriction,
custName ).

Is there a way to have a generic query to a custName table by referencing
its position in the search_path?

Example
select * from mytable; -- Gives restricted answers
select * from super.mytable -- Gives custName answers

Currently this is done by public.mytable, but I am curious if there is a
generic way without having to know the custName schema.

Thanks
Woody
iGLASS Networks
www.iglass.net

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Schmidt 2013-11-08 19:44:42 How to script inserts where id is needed as fk
Previous Message David Johnston 2013-11-04 21:15:34 Re: json and aggregate