The SQL execution panel allows the user to run any SQL command on the server. There are additional features that permit loading and saving SQL commands, performing text searches in the loaded command set, using code snippets, accessing a history of executed instructions, and exporting the results of commands to a file in CSV format for later usage in any third-party software.
The image below shows the widget's layout. In the top-left corner we have all available actions reunited, being them: Run
, Script
, Code
, Results
, Clear All
, Output
, Variables
. All their functions will be detailed shortly. Continuing to describe the widget, in the top-right corner, a string denoting the currently managed database is displayed in the form database
@server:port
, which helps to avoid running commands on the wrong server. Finally, the portion at the bottom is reserved for the results of the commands, which may be a grid of data or a message, as well as the command history panel. The actions of this widget are detailed as follows:
Action | Description |
---|---|
Add new execution tab |
From the SQL execution, there's a possibility to add extra execution tabs by hitting Ctrl + T or clicking ![]() |
Run |
Executes the current typed SQL commands against the currently established connection. Use the shortcut key F5 to perform the execution. You can also select fragments of the typed commands and run them by using this same action. In newer versions of pgModeler, you can abort the execution by hitting Esc anytime or clicking the action Stop . |
Script |
This button reunites in a menu the actions to load and save external SQL scripts to be used in the SQL execution panel. |
Code |
This button reunites in a menu the actions to perform text searches, code lines wrap, and snippets handling. |
Clear all |
Clears the results grid as well as the typed commands. |
Results |
Reunites actions that can be performed on query results, like exporting them to an external file. There is also an action that allows extra filtering on the data retrieved from the executed SQL commands. The first combo box is a list of the table's columns where the filtering should operate. The second field is the filtering pattern itself. As the user types any text in the field, the data filtering will happen automatically. The other fields are checkboxes used to determine the filter matching: case sensitivity, usage of regular expressions, or exact matching. |
Output |
Toggles the display of the results grid, error messages, or history panel. This is useful when there is a need for more space on the screen, either to type or read commands. Note that the output is automatically restored whenever a command is executed. |
Variables |
Toggles the widget responsible for running parameterized queries using variables. This feature is available only on pgModeler Plus and is detailed in Chapter 8. |
The results grid can be handled in such a way as to copy or save the selection in two distinct formats by right-clicking items: plain text format where values are separated by tabulation and CSV format where values are separated by a semicolon (see below).
In the same way, the history panel has a context menu that enables the user to interact with its contents. The available operations that can be done via the context menu are: search in history, reload it, save it to an external file, and clear the entire commands registry. Also, another way to interact with the history is by selecting fragments on it and then pressing the middle button of the mouse to quickly copy and paste the selection in the SQL execution panel.