Cross-schema view issue/question - Mailing list pgsql-general

From Bosco Rama
Subject Cross-schema view issue/question
Date
Msg-id 4DA7AE6D.1030605@boscorama.com
Whole thread Raw
Responses Re: Cross-schema view issue/question
List 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.

pgsql-general by date:

Previous
From: Jerry Sievers
Date:
Subject: Re: How can you have an Exclusive Lock on nothing? please help me understand this lock monitoring query output
Next
From: Adrian Klaver
Date:
Subject: Re: Compression