6.11.2. SQL execution panel

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 below image shows the widget's layout. In the top-left corner we have all available actions reunited, being them: Run, Script, Search, Clear All, Snippets, Export, Filter, Output. 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 helping 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.
Search Toggles the text search form that will find occurrences of the desired terms in the typed commands. Additionally, it is possible to make replacements and adjust how words are searched by using regular expressions, case sensitivity, and exact matching.
Clear all Clears the results grid as well as the typed commands.
Snippets This action gives access to all available snippets through a pop-up menu. By selecting a single item the code related to it will be appended to the current SQL commands.
Export Exports the current result set to a CSV file to be handled in any third-party software.
Filter Toggles the results filtering where it's possible to perform extra filtering in the data retrieved from the executed SQL command. 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 the 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.

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.

Mar 15, 2024 at 09:20