### Editing Views, Stored Procedures or Functions

When editing the code for a view, stored procedure or function, instead of using the small text box on the properties dialogue for the object, you might find it more convenient to use the scripting options in pgAdmin to edit the object in the query tool. This gives you the benefit of the Query Tool editor's features such as autocomplete, find and replace and larger workspace.

To use the scripting options, in the pgAdmin browser window, right-click the object you wish to edit, and select the CREATE script option. It may be on the Scripts submenu. Alternatively, you can select the object and then choose the CREATE script option from the Scripts submenu of the Tools menu.

Edit the definition of the object as required, and use the Execute Query button to apply your changes. Don't forget that modifying a view or function name, or the signature of a function or procedure may result in a new object being created alongside the original one. This useful side effect makes it convenient to create new, but similar objects. You may need to refresh the pgAdmin browser to display newly created objects.

You can use this technique to perform all sorts of operations on different objects, however PostgreSQL's CREATE OR REPLACE syntax makes it particularly useful for editing views, stored procedures and functions.