Connect with psql

Use the PostgreSQL interactive shell with PLOMID for queries, scripts, and inspection.

Version
Latest
v0.1.0 · latest 2 min read
On this page
  1. Prerequisites
  2. Connect
  3. Everyday commands
  4. Scripts and timing
  5. TLS
  6. Troubleshooting

Status: Supported. psql is the fastest way to run the guides in this documentation.

Prerequisites#

Connect#

shsource
psql "postgresql://plomid:secret@localhost:5432/plomid"

DBeaver and other GUI clients use the same values: host 127.0.0.1, port 5432, database plomid, user plomid, password secret (or your configured values).

Everyday commands#

sqlsource
-- Schema inspection
\dt              -- list tables
\d users         -- describe a table
\dn              -- list schemas
\l               -- list databases
 
-- Work
SELECT * FROM users ORDER BY id LIMIT 5;
EXPLAIN SELECT * FROM users WHERE name = 'ada';
BEGIN; UPDATE acct SET bal = bal - 10 WHERE id = 1; COMMIT;

PLOMID also answers catalog queries directly: SHOW <setting>, DESCRIBE <table>, USE <database>, and live rows from pg_catalog / information_schema — see Catalog and SHOW / DESCRIBE.

Scripts and timing#

shsource
psql "postgresql://plomid:secret@localhost:5432/plomid" -f schema.sql
psql "postgresql://plomid:secret@localhost:5432/plomid" -c "SELECT count(*) FROM users;"
sqlsource
\timing on   -- per-statement timings inside psql (useful with EXPLAIN ANALYZE)

TLS#

shsource
psql "postgresql://plomid:secret@localhost:5432/plomid?sslmode=require" -c "SELECT 1;"

Against a TLS-enabled server, sslmode=require negotiates a TLS session (verified). Without server-side --tls, the parameter is refused or downgraded per libpq policy — see TLS.

Troubleshooting#

Symptom Fix
connection refused Server not running or wrong port — check the startup banner and PLOMID_PORT.
password authentication failed Wrong user/password — the server default is plomid, start.sh uses secret; always confirm which you started with.
CREATE/DROP DATABASE cannot be executed inside a transaction block Run it as a bare statement (psql sends -c strings plainly; drivers may wrap — see Pooling and errors).

Next: SQL fundamentals · Python.

Was this page helpful?