SQL Editor
Top  Previous  Next


SQL Editor is the basic PostgreSQL Manager tool for creating and executing database queries. It allows you to create and edit SQL text for the query, prepare and execute queries and view the results of execution. SQL Editor supports Quick Code and Syntax Highlight systems, which make your work much easier.

Edit  
 
The main area of the editor is situated on the Edit tab. This area is provided for working with the text of the query. For your convenience the Quick Code system is enabled, i.e. when you type first word symbols in the SQL text editor you are offered some variants for the word completion in a popup list (analogue of the Code Insight in Delphi IDE).

You can activate these popup lists yourself by pressing the following key combinations:

Ctrl+Space    All SQL keywords and database objects;
Ctrl+Alt+S   SQL glossary;
Ctrl+Alt+T   Table list;
Ctrl+Alt+V   View list;
Ctrl+Alt+F   Function list;
Ctrl+Alt+R   Rule list;
Ctrl+Alt+S   Sequence list;
Ctrl+Alt+A   Aggregate list;
Ctrl+Alt+O   Operator list;
Ctrl+Alt+L   Language list;
Ctrl+Alt+Y   Type list;
Ctrl+Alt+G   Trigger list.

You can change the sorting mode of the Code Completion list items by right-clicking in the popup list and switching to the sorting mode you need: sort alphabetically by item names or sort by the scope categories (SQL keywords, tables, functions, etc).
Database objects are highlighted in the text. You can open the proper object editor by clicking the object name in the text, holding button Ctrl pressed on the keyboard.

The popup menu of the edit area contains standard functions for working with text (Cut, Copy, Paste, Find, Replace, Toggle Bookmarks, etc) and also functions for processing the whole query, which allow you to execute/prepare query, save/load query to/from file, and preview/print query.

When the query text is ready, click button Execute on the toolbar or press F9 to check the query text for errors. If there are any errors in the query text, these errors will be displayed in the bottom area of the editor window, and the text line, containing the first error, will be indicated with a purple line.

If the text is correct the query is executed and the Results area becomes active.

Results  
 
This area displays the result data returned by the query. They can be viewed in three modes (chosen by clicking the according button at the bottom of the window):

Grid View
View data as a grid;

Form View
View data as a form: there is only one record displayed at the time, to view another record use the navigation buttons.

Print Data
View data in WYSIWYG mode, ready for printing. The acquired query can be saved to filed and/or printed.

These data can't be edited, but can be exported (Export Data item in the popup menu or button on the toolbar) or exported as INSERT statement to the SQL Script (Export as Insert item in the popup menu or button on the toolbar).

The status bar displays the number of records, acquired while executing the query. The comment bar also displays time of execution.

Logs  
 
On the Logs page information of all the executed statements, including queries and carried out transactions, is displayed.

SQL Editor Toolbar  
 
Button
Action


Databases
Drops down with a list of registered databases, allowing you to select the database for the query.
Load
Loads the query text from an *.sql file.
Save
Saves the query text to an *.sql file.
Save All
Saves all the queries to one *.sql file.
Help on SQL
Opens the PostgreSQL Help window.
Execute
Executes the query.
Default Size and Position
Brings the window to its default size and position (restricted by the main window and DB Explorer).
Visual Query Builder
Activates the Visual Query Builder window for visual building the query.
New Query
Creates the new clean page for the new query.
Delete Current Query
Clears the current query page.
Clear All History
Clears all the query pages open.
Commit Transaction
Commits the current transaction.
Rollback Transaction
Rollbacks the current transaction.
Find
Activates the Find Text Dialog for searching the given text in the query text.
Export Data (Results tab only)
Activates the Export Data Dialog, which allows you to export the result query data to file.
Export Data as INSERT Statements (Results tab only)
Activates the Export Data As Insert Dialog, which allows you to export the result query data to the SQL script as INSERT statements.


See also:
Visual Query Builder
SQL Script Editor
SQL Monitor


Availability:
Windows Professional

Yes

Windows Lite

Yes

Linux Professional

Yes

Linux Lite

Yes