Search for text in any function

From: "Rob Richardson" <Rob(dot)Richardson(at)rad-con(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Search for text in any function
Date: 2009-02-19 17:46:41
Message-ID: 04A6DB42D2BA534FAC77B90562A6A03DCD3E84@server.rad-con.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings!

Can anyone suggest a query that will tell me the names of all functions
(both trigger and normal) that contain a given string of text?

Here's what happened:

My company's database has a table named "charge" and a view named
"availcharges" that returns all charges that are available. The view's
SELECT statement lists all fields in the charge table explictly.

We have two functions that use data in the charge table the same way:

declare
ChargeRec charge%rowtype
begin
select into ChargeRec * from availcharges

This used to work. But then one of us added a field to the charge
table, as the last field in the table. The availcharges view was
adjusted accordingly. However, behind the scenes something changed.
I'm pretty sure that the view no longer returns fields in the same
order. My immediate fix was to suggest using either

declare
ChargeRec record;

or

declare
ChargeRec availcharges%rowtype;

Either one works.

But I need to make sure that we don't get burned by this anywhere else.
Therefore, I would like to be able to find all functions that uses the
phrase "charge%rowtype". I haven't been able to find where the text of
functions is stored.

Thank you very much.

RobR

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-02-19 17:55:35 Re: When adding millions of rows at once, getting out of disk space errors
Previous Message Tom Lane 2009-02-19 17:46:14 Re: Aliasing syntax question