Domanda

I have a database with almost 400 functions in PostgreSQL. Among them many functions have RAISE INFO for debug purpose . Now I want to comment this RAISE INFO in all the functions. For that I use below query:

UPDATE information_schema.routines SET routine_definition = REPLACE(routine_definition,'RAISE','-- RAISE') WHERE (routine_definition) like '%RAISE%' 

But it gives me below error:

ERROR: cannot update view "routines"
SQL state: 55000
Detail: Views that do not select from a single table or view are not automatically updatable.
Hint: To enable updating the view, provide an INSTEAD OF UPDATE trigger or an unconditional ON UPDATE DO INSTEAD rule.

I don't know how to do this.

È stato utile?

Soluzione

You want pg_proc.prosrc, although I'd be concerned about altering other RAISE statements too with your approach.

Altri suggerimenti

Thanks Richard Huxton

Here is the Details query for reference:

 UPDATE pg_proc SET prosrc = REPLACE(prosrc,'RAISE','-- RAISE') WHERE (prosrc) like '%RAISE%'
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top