Choose your database:
MS SQL Server
SQL Anywhere

Subscribe to our news:
Chris Passion: "I tried 3 different programs before yours and none would be so handy and helpful. PostgreSQL Maestro works great and couldn't be easier to install".
Simon Pills: "Someone finally invented an intuitively used and easily customized PostgreSQL database administration tool! Keep up the good work. I will be in touch. I am able to do this horrendous work because your software enabled me to create a new database with all necessary objects in several minutes! I am sure that I have found what I really need".


Add your opinion

PostgreSQL Maestro online Help

Prev Return to chapter overview Next

SQL Editor

SQL Editor is a tool for creating and executing SELECT queries. It allows you to create and edit SQL text for the query, prepare and execute queries, and view the results of execution. To open SQL Editor, select the Tools | SQL Editor main menu item. The most popular query management actions (creating, editing, deleting) are covered by the corresponding topic.


To use the editor for working with several queries, open new query tab with the Create new query link on the Navigation bar. With the tabs’ popup menu you can create a new query, close existing one, save the query to profile, etc even if editor's navigation bar is closed. Queries' tabs can been displayed at the all sides of the editor (bottom, top, left or right).


For more information about query executing and working with query result see the corresponding topic.


       Working with query text


The popup menu of the editing area provides you with standard operations for working with text such as Cut (Ctrl+X), Copy (Ctrl+C), Paste (Ctrl +V), Undo (Ctrl+Z), Redo (Shift+Ctrl+Z) along with a possibility to convert selected text to different cases (lower, UPPER, and NameCase).


You can also comment/uncomment selected text (Shift+Ctrl+. and Shift+Ctrl+, shortcuts respectively). If no text is selected, the whole line will be commented. By the way, it is not necessary to select commented text to uncomment it, just press Shift+Ctrl+, having the cursor inside the commented text. Both kinds of comments (single-line and multi-line) are supported. SQL Formatter is also at your disposal.


SQL Editor allows you to use Visual Query Builder modal instance to design query visually and load the result query text directly in the editor area. For this purpose use the Design query link of the editor area's popup menu.


       Code completion


PostgreSQL Maestro provides you with code completion (as on the screen below) to select from a list of tables, columns, views, or other objects without having to manually enter the object's name in the editor. You can activate the completion list by pressing the Ctrl+Space key combination.


       Syntax  highlighting


Database objects are highlighted in the text. You can open the proper object editor by clicking the object name in the text with the Ctrl key pressed or with the Find Object link on the Navigation bar. To adjust the highlighting settings, use SQL highlight options.


       Line modification markers


Lines of code that have been edited during the current session are indicated with a yellow line in the left margin of the editor. When you save the file, the yellow markers turn green. Thus at any time, yellow markers show changed but unsaved lines of code, and green markers show changes in this session that have been saved.


       Find and replace text


Use find and replace to search for, and optionally, replace text in the SQL Editor. To open Find text/Replace text window, use Edit | Find/Replace main menu item, corresponding link of popup menu, or Ctrl+F/Ctrl+H shortcut. You can also use the Search again link to apply recent Find text dialog.


       Transaction management


SQL Editor supports the explicit transaction management. You can execute queries either in autocommit mode (default behavior) or manage transactions manually. In the second case you have to issue the BEGIN statement to start a transaction and explicitly end the transaction by COMMIT or ROLLBACK statements (it is also possible to use the corresponding links at the editor's navigation bar).



To load query from .sql file, use the corresponding link on the Navigation bar. You can also find there links allowing you to save query text to file, export the contents of the editor to RTF and HTML formats (to file or to clipboard), copy the selected text from to clipboard as a ready-to-use string written in one of the following programming languages: C#, C++, Delphi (Object Pascal), and Java, and also print/preview the contents of the editor.


See also: Visual Query Builder, SQL Script Editor, SQL Editor Options

Prev Return to chapter overview Next