PostgreSQL

From Sasara
Revision as of 23:43, 17 January 2026 by Rubenerd (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Postgres is a database. This is a bit of a cheat sheet.

Enumerated types

I generally still prefer tables, but this is quicker/easier.

Creating

CREATE TYPE arch32 AS ENUM ('x86','macppc','sparc','alpha');

Listing all properties

\dT+ arch32

Listing values (simpler)

select enum_range(null::arch32);

Export SQL for later insertion

pg_dump -h $HOST -U $USER --dbname $DATABASE -t $TABLE \
  --data-only --column-inserts > $TABLE.sql