HomePostgreSQLArticle
PostgreSQL Mechanics
psql Tutorial: Read the Session Before You CREATE | Master Class E02
psql tutorial: read the PostgreSQL session before you CREATE. A prompt can look connected and still not name the database, the role, or where an unqualified table will be created. This PostgreSQL psql lesson shows the commands that answer that before any DDL: - Start psql, then read current_database(), current_user, and SHOW search_path - SQL goes to the server.
Backslash commands stay in the psql client - A hyphen in the prompt means unfinished SQL. \r clears the query buffer and does not roll back an open transaction - A table lives in a schema, inside a database, on one server - A temporary table dies with the session. Another session cannot see it - \x changes how psql prints one row.
\pset changes the client, not the rows the server returned - \watch repeats the last query in the client. It is not a server job, and this episode does not leave a watch running - ON_ERROR_STOP makes a script stop after an error. ON_ERROR_ROLLBACK stays inside the transaction and undoes the failed statement - A psql variable is text in the client Watch this after the PostgreSQL 18 install, before you rely on a prompt that only shows a database name.
PostgreSQL Master Class
Watch the video for the full walkthrough. Use this page when you want the argument in writing without scrubbing the timeline.