Re: dropping a schema and cross-schema dependencies

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-sql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: dropping a schema and cross-schema dependencies
Date: 2007-04-07 00:05:37
Message-ID: 8C5B026B51B6854CBE88121DBF097A86A2CB21@ehost010-33.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> > As an immediate solution can anyone share a comprehensive query to
> > INFORMATION_SCHEMA/PG_CATALOG that can be used to check for any
> > cross-schema dependencies and halt before issuing a DROP
> with a CASCADE?
>
> Issue the DROP without CASCADE and read the error message.

Well, to be precise I should read the notices preceding the error
message (the error message is the same whether there are within- or
cross-schema dependencies). But, yes, that's what I have been doing, I
was hoping for something a little more graceful. Ideally I want a DROP
SCHEMA in a script to succeed without bothering me if there are no
cross-schema dependencies and only to fail if there are cross-schema
dependencies. So I was hoping I could check ahead of time and in a
definitive way that there are no cross schema dependencies and then
issue a DROP CASCADE. What you are suggesting is to issue a DROP without
CASCADE and grep through the error message before issuing a second DROP
CASCADE, but what am I grepping for? What are all the possible notices
that pertain to cross-schema dependencies? I want to make sure I am not
missing something that I have not seen before. So, for example we might
have a notice like this:

NOTICE: table test.employee column first_name depends on type name_ud

So, if the word "table" is followed by a word that contains a period I
have a cross-schema dependency. This could work. I just want to be
comprehensive.

George

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Karthikeyan Sundaram 2007-04-07 17:33:19 rowcount function in postgres???
Previous Message Tom Lane 2007-04-06 23:39:38 Re: dropping a schema and cross-schema dependencies