PostgreSQL: Difference between revisions

From Sasara
Jump to navigationJump to search
No edit summary
No edit summary
 
Line 17: Line 17:
  pg_dump -h $HOST -U $USER --dbname $DATABASE -t $TABLE \
  pg_dump -h $HOST -U $USER --dbname $DATABASE -t $TABLE \
   --data-only --column-inserts > $TABLE.sql
   --data-only --column-inserts > $TABLE.sql
==Useful links==
* [https://dlt.github.io/blog/posts/introduction-to-postgresql-indexes/ Dalto Curvelano: Introduction to PostgreSQL Indexes]


[[Category:Tech]]
[[Category:Tech]]

Latest revision as of 23:55, 1 March 2026

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

Useful links