DB Solo
Back to Index


PostgreSQL Function Editor

The PostgreSQL Function Editor allows you to view, edit, compile and run PostgreSQL functions. It is supported on all platforms that DB Solo runs on; Windows, Linux, MacOS X and Solaris.

Starting the Function Editor

To start the function editor, navigate to the desired function in the schema browser, select the 'Source Code' tab and click on the 'Edit In Function Editor' button. Alternatively, you can right-click on the function in the schema browser and select 'Edit In Function Editor'. At this point a new function editor tab will be opened for the function you selected.

Overview

The left side of the function editor has two buttons that will show a mini-panel when selected. The Browser and Directory panels work the same way as in the query window. The function editor has its own toolbar that allows you to perform various operations on the selected function. It also allows you to select a different function to edit. The function can be under a different server or different database within the same server. The toolbar has the following buttons

Compiling Program Units

To compile the function using the latest code in the editor, click on the Compile-button in the toolbar. The bottom of the screen will show the results of the compilation in a tab named 'Compiler'. In case of errors, the errors will be listed in this tab including the PostgreSQL error codes.

Executing Functions

After compiling the code successfully, you can run the program unit. To do so, click on the 'Run' button in the toolbar. This will bring up the Run-dialog that will contain code that will be executed when you click on 'Run'. Code will be automatically generated to declare the required variables and call the function correctly. Notice that you can modify the generated code, e.g. to change the values that will be passed into your program unit. The modified code will be automatically persisted for further executions. To revert back to the automatically-generated block, click on the 'Reset' button. To close the dialog without running the function, click on the 'Close' button.

When the program unit is running, you can stop the execution by clicking on the 'Stop' button in the toolbar. After the function has been executed, you will see the execution results in the 'Run' tab at the bottom of the screen. Output from the print statements, if any, will also be shown in this tab.

Comparing Source Code

The 'Compare' button in the toolbar allows you to compare the source code in the editor and the code in the database. This is useful if you don't remember what exactly you modified and don't want to compile before you know for sure. When the button is clicked, a new dialog will be show that shows the code in the editor on the left and the code in the database on the right. All lines that are different/added/removed will be highlighted.


Back to Index DB Solo
www.dbsolo.com
support@dbsolo.com