Cross-schema view issue/question

From: Bosco Rama <postgres(at)boscorama(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cross-schema view issue/question
Date: 2011-04-15 02:33:17
Message-ID: 4DA7AE6D.1030605@boscorama.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi folks,

We have a current DB on PG 8.4.7 on Ubuntu Server 10.04 LTS.
This DB used to only have one schema and that schema was replaced
on a regular schedule using a pg_dump/pg_restore process. The old
schema was renamed to another name and the incoming schema and data
replaced it in the DB. If an old renamed schema was present at the
time it was dropped prior to the renaming above. This schema is only
writable by the owning user. There are other users that read this
schema/data for reports and other tasks.

Let's call that schema 'abc'.

This was all well and good until a user (quite rightly) decided to
create their own views of the 'abc' schema in their own schema which
we'll call 'xyz'.

The issue that has arisen is that we can no longer simply rename/drop
the 'abc' schema as the other user's schema objects in 'xyz' now refer
to objects in 'abc'. At least, not without dropping their objects as
well. Not a good thing.

My quesion is: Is there any way to reduce/eliminate the tight coupling
of the views, et al. in schema 'xyz' to those in 'abc'? My thoughts have
brought me to:
1) a function that removes/creates the views, etc in the 'xyz' schema
that gets called as part of the replacement process for schema 'abc'

2) replacing the views, etc. with functions that return tables or
the results of dynamic queries.

3) have the user create the views, etc. as 'temp' items in their
session each time. Though this may still conflict with the
replacement since there will still be a tight coupling between
the temp objects and the 'abc' schema and the replacement occurs
regardless of the current state of user connections.

None of these is very appealing.

Anyone have any thoughts or suggestions? Or even an RTFM reference. :-)

TIA,
Bosco.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-04-15 02:42:01 Re: Compression
Previous Message Jerry Sievers 2011-04-15 02:26:35 Re: How can you have an Exclusive Lock on nothing? please help me understand this lock monitoring query output