No documentation was found matching the provided version! Browsing the latest one.

6.11.1. Database explorer

In the database explorer, the user first needs to connect to a server by choosing a connection in the first combo box (see the image below, in its top left corner) to get the list of available databases. Once connected, the second combo box will be filled up with the names of all accessible databases. The database explorer can manage several database instances, to do so just change the current connection to get a new list of databases.

When an item is selected in the database list it'll be automatically browsed creating a new tab with the name of the selected database (see the tab named demodb in the image below). Browsing a database will cause a tree of objects to be created representing the hierarchy existing there. Any element in the tree can be handled by right-clicking it and activating one of the actions available on the pop-up menu as highlighted in the image. Note that the actions in the menu may vary according to the selected object in the tree.

Another useful component in the database explorer is the object attributes grid right below the objects' tree. This special widget stores the metadata of any object in the database in a (key, value) form. The list of attributes varies according to the kind of the selected object. For grouping items, for instance, Table (3), the attributes grid is not displayed. All actions and controls available for the database explorer are detailed below.

Database explorer controls and actions

Control/Action Description
Connections combo This combo stores all configured connections that can be used to browse databases. A connection is performed automatically when selecting an item in the listing. To close all browsed databases and open connections click the button . Note that disconnecting from all databases will cause any tab open in Database explorer or in SQL Execution to be closed.
Databases combo This combo lists all databases available for the current connection. When selecting a database in this combo it'll be automatically browsed. You can use the button aside from the combo box to refresh the list of databases.
Database tab Every time a database is browsed a new tab is created with the very same name of the handled database. In this tab, we have separated controls and actions to allow filtering and several operations over the current database. In the image above there's a set of six tool buttons at the top of the objects tree which perform specific actions over the current database being explored.
Filtering options The objects tree filtering can be triggered by clicking and toggling the actions Show objects filter, Show system objects, Show extension objects. The first option toggles the display of the filter fields right below the database tree. There one can use keywords to match items whose names start with the specified filtering term. There's a secondary option in the filter named By OID which causes the filtering keyword to be interpreted as an object ID (OID) and instead of matching names the IDs of the database objects will be used in the comparison.

The second option toggles the display of system objects in the tree, in the same way, the third option causes extension objects to be displayed as well. Every time the user toggles these two options the tree is reloaded to reflect the filtering options.
Sort database objects The items in the database objects tree can be sorted by toggling the button . When this option is checked the objects are sorted alphabetically, while unchecked, causing the objects to be sorted by their OID.
Open data manipulation dialog By clicking the button or hitting the shortcut Alt+G you can access the data manipulation window to handle table or view data in different ways. The data manipulation dialog is detailed in the last section of this chapter.
New SQL execution tab By clicking the button or using the shortcut Ctrl+T opens a new SQL execution tab for the current database. This is useful when you need to run different commands without losing previous results or even compare the results if needed.
Update the database tree There are two ways of refreshing the database objects tree. The first, Quick refresh triggered by Alt+F5, updates the database tree until the schema level. Objects under schemas such as tables, views, functions, data types, and many others aren't displayed. To show children of schemas, one must expand a schema item manually so the subtree of that object is updated on demand.

The second way to refresh the tree is through the Full refresh action or by hitting Ctrl+F5 which causes the database tree to be populated with all objects in the database from roles to columns. This operation takes much longer to perform depending on the size of the database being managed so use it wisely. Additionally, both actions can be triggered from the icon .
Drop the database To drop the currently browsed database click the button . Note that this action will completely wipe out any data related to the database so make sure to have a backup before proceeding.
Attributes grid This grid displays the main attributes of an object. The available attributes and values vary according to the object selected in the tree. Multiple values for the same attributes are stored in a combo box.
Show raw attributes This option causes the user-friendly names assigned to the object's attributes to be hidden and the internal names to be exposed. This is useful if you intend to create snippets using the object's attributes as placeholders. Details about snippets creation can be seen in the Snippets settings in Chapter 4.
Toggling attributes and source At the bottom of the database explorer widget there are two toggle buttons labeled Attributes and Source code which toggle, respectively, the attributes grid and the object's source code panel in the SQL execution widget. The state of these buttons is persisted in a configuration file which means that in the next execution, pgModeler will restore the visibility state of the controls related to them.

Pop-up menu actions

Control/Action Description
Update Refreshes the currently selected item. If the item is a grouping one all the children will be updated as well.
Handle data Opens the data manipulation dialog with the first 1000 rows loaded. This action is available only for tables, foreign tables, and views. The data manipulation dialog is detailed further in this chapter.
Reload properties Causes the properties or attributes grid to be refreshed.
Source code Display the currently selected object's SQL definition in the Source code panel.
Rename Triggers the object renaming action. The selected item enters in the name change mode until the Enter is pressed to confirm the new name. To cancel the renaming, the user must hit Esc.
Drop object Drops the selected object from the database by calling the DROP command over it. If the object is referenced by any other the drop will fail due to references breaking. To drop the selected object as well as its references use the action Drop cascade.
Drop cascade Drops the selected object and its references from the database. This action will destroy more objects than selected by the user so take extreme care when using it.
Truncate This action will completely wipe out any data from the selected table by calling a TRUNCATE command over the object. If the data in the table is referenced by others the truncate operation will fail due to references breaking. To truncate the selected table and its references use the action Trunc. cascade.
Trunc. cascade This action will completely wipe out any data from the selected table and its references. This action will wipe out all data of the selected table and its references so take extreme care when using it.
Snippets This special submenu lists the available snippets for the currently selected object. When selecting a parsable snippet from the listing the values from the object's attributes will be used in the snippet's placeholders.

Mar 15, 2024 at 09:02