Re: How to correct schema-names within function when the schema gets renamed?

From: damien clochard <damien(at)dalibo(dot)info>
To: Andreas <maps(dot)on(at)gmx(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to correct schema-names within function when the schema gets renamed?
Date: 2011-08-29 13:38:13
Message-ID: 4E5B9645.2050805@dalibo.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Le 29/08/2011 13:44, Andreas a écrit :
> Hi,
> how can I correct schema-names within function when the schema gets
> renamed?
> PG corrects automagicaly every view and foreign key.
>
> Though I found that it doesn't update the schema-name in sql-functions.
> Say there where a table "bar" in the schema "foo"
> and there is a function f(int) that results to "select * from foo.bar
> where id = $1".
>
> Then I rename "foo" to "sansi" and all seems nice till I call f().
> Now I get an error that schema "foo" can't be found.
>
> How could I find all functions that use the now uncorrect schema-name?
>

Not sure, but the query below might help :

SELECT proname,prosrc
FROM pg_proc
WHERE prosrc LIKE '%foo.%';

--
damien clochard
dalibo.com | dalibo.org

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Merlin Moncure 2011-08-29 13:41:09 Re: How to correct schema-names within function when the schema gets renamed?
Previous Message pasman pasmański 2011-08-29 11:55:22 Re: nice updates