Sub topic 12
Navigating the pgAdmin Object Browser
Prerequisites and the browser model
This chapter assumes that you know basic SQL, can use a terminal, and have access to a PostgreSQL server. You should also understand tables, columns, primary keys, and foreign keys.
The pgAdmin object browser is a tree view for exploring PostgreSQL. It begins with registered servers and narrows through databases, schemas, and database objects. Selecting an object displays its properties, while right-clicking it opens actions such as viewing data, generating SQL, or opening the Query Tool.
A PostgreSQL server can contain several databases. Each database contains schemas, and schemas contain objects such as tables, views, sequences, functions, and types.
Expand the tree in a deliberate order
In the left-hand Browser panel, expand these nodes:
- Servers: contains the PostgreSQL servers registered in pgAdmin.
- The registered server: contains connection-level information.
- Databases: contains databases on that server.
- Your database: contains objects for one database.
- Schemas: contains namespaces such as
public. - Your schema: commonly
public. - An object group, such as Tables or Views.
A schema is a namespace that separates objects with the same name. For example, both sales.orders and archive.orders can exist because their schema-qualified names differ.
| Browser node | What it contains | Useful question |
|---|---|---|
| Databases | Separate database environments | Am I in the correct database? |
| Schemas | Namespaces within a database | Which application owns this object? |
| Tables | Stored rows and columns | What data does this table hold? |
| Views | Saved queries | Is this object computed from other tables? |
| Indexes | Lookup structures | How might PostgreSQL find rows quickly? |
Inspect a table
Expand Tables, then expand a table such as orders. Its child nodes reveal parts of the table definition:
- Columns shows names, data types, defaults, and nullable settings.
- Constraints shows primary keys, foreign keys, unique constraints, and checks.
- Indexes shows indexes attached to the table.
- Triggers shows actions that run when rows change.
- Rules and Policies show additional behavior and access controls.
Right-click the table and choose Properties to inspect settings in a form. Use View/Edit Data when you need to browse rows. Use Scripts to generate SQL such as CREATE, SELECT, or INSERT statements. Generated SQL is useful for understanding an object, but review it before running it on another database.
Refresh and check your context
The browser is a view of the server, not a permanent live list. After creating or renaming an object, right-click the relevant node and choose Refresh. Refresh the database or schema when a new object does not appear.
A common mistake is expanding a similarly named database or schema. Confirm the database name in the tree before inspecting a table. Another mistake is assuming that a missing object was deleted. Your role may lack permission to see it, or the object may belong to another schema.
The browser also helps you discover relationships. Open a table's Constraints and Indexes nodes to see how it connects to other tables and how searches may be supported. For a broader relationship diagram, use pgAdmin's ERD tool after you understand which database and schema you are viewing.
Exercise
You expanded the public schema but cannot find a table called orders. What should you check first?
Show answer
Confirm that you opened the correct database, refresh the Tables node, and check whether your role has permission to see the table. Also verify that the table is not in a different schema.