pgAdmin
Objectives
By the end of this lesson, you should be able to:
- Connect to your PostgreSQL server using pgAdmin
- Find your way around pgAdmin’s object browser
- Open the Query Tool and run a SQL statement
๐ก Why this matters: pgAdmin gives you a visual way to see everything in your database, servers, databases, schemas, tables, all in one browsable tree, without memorizing commands. Plenty of real database work happens exactly this way.
โ ๏ธ A note on verification: pgAdmin’s layout described here reflects its current, stable, documented interface (pgAdmin 4), but wasn’t operated inside this course’s own tooling. The SQL you type into its Query Tool behaves identically to SQL run anywhere else in this course, already verified against a real PostgreSQL engine.
Opening pgAdmin and Registering a Server
The first time pgAdmin opens, it asks you to set a master password, this protects any saved connection passwords, not your PostgreSQL account itself. After that, you register a connection to your PostgreSQL server:
- Right-click Servers in the left panel, choose Register > Server.
- On the General tab, give it a name, anything you like, “Local PostgreSQL” works fine.
- On the Connection tab, set the host to
localhost, leave the port as5432(PostgreSQL’s default), and enter the username (postgres) and the password you set during installation. - Save. pgAdmin connects, and your server appears in the tree on the left.
The Object Browser
The left panel is a tree you can expand, drilling down exactly the way the database hierarchy actually works:
Servers
โโโ Local PostgreSQL
โโโ Databases
โโโ postgres (the default database)
โโโ Schemas
โโโ public
โโโ Tables
Expanding a table shows its columns, constraints, and indexes directly, no query required. This tree is a visual way to browse the exact same structure covered earlier in this module, server, database, schema, table.
The Query Tool
Browsing is only half of pgAdmin. To actually run SQL, right-click a database and choose Query Tool (or use the lightning-bolt icon in the toolbar once a database is selected). This opens a text editor connected directly to that database, type SQL, run it, and see results in a table below, exactly like every query shown throughout this course.
SELECT version();
Running that in the Query Tool returns a row showing exactly which PostgreSQL version you’re connected to, a quick way to confirm everything is working.
Try It
- Open pgAdmin and register your local PostgreSQL server.
- Expand the tree down to Databases > postgres > Schemas > public > Tables (it’ll be empty for now, that’s expected).
- Open the Query Tool against the
postgresdatabase and runSELECT version();, confirm it returns a result.
Recap
- pgAdmin is PostgreSQL’s official graphical client, connect to a server by registering it with a name, host, and credentials.
- The object browser tree mirrors the real hierarchy: server, database, schema, table.
- The Query Tool runs actual SQL against a selected database and shows results in a table.
Next lesson: the other way to talk to PostgreSQL, the psql command-line client.