Re: Grep'ing for a string in all functions in a schema?

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Grep'ing for a string in all functions in a schema?
Date: 2014-01-30 22:16:36
Message-ID: lceiv2$au0$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Wells Oliver wrote on 30.01.2014 21:45:
> Since Postgres does not consider a table as a dependency of a
> function if that table is referenced in the function (probably a good
> reason), I often find myself in a position of asking "is this
> table/sequence/index referenced in any of these N number of
> functions?"
>
> Is there an easy way of essentially grep'ing all of the functions in
> a given schema for a string?
>
> Clearly if you had all of your functions in a nice VCS you could do
> this but alas I don't yet live in that perfect world.

As I occasionally come across this myself, I have built such a feature into SQL Workbench/J

http://sql-workbench.net/manual/wb-commands.html#command-search-source
http://sql-workbench.net/wbgrepsource_png.html

or through the UI
http://sql-workbench.net/objectsearcher_png.html

it offers a bit more flexibility than just a LIKE on the source code

(but that is of course not available if you are using psql or pgAdmin)

Thomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-01-30 22:19:42 Re: Database snapshots or clones for staging and testing.
Previous Message Tim Uckun 2014-01-30 22:12:13 Database snapshots or clones for staging and testing.