Skip to main content

Tables

Basic Tables

All Column Types

pgtofu supports all PostgreSQL built-in types:

Identity Columns

Modern alternative to SERIAL (PostgreSQL 10+):

Generated Columns

Computed columns (PostgreSQL 12+):

Constraints

Primary Key

Foreign Keys

Referential Actions:
  • ON DELETE CASCADE - Delete dependent rows
  • ON DELETE SET NULL - Set FK to NULL
  • ON DELETE SET DEFAULT - Set FK to default
  • ON DELETE RESTRICT - Prevent deletion (default)
  • ON DELETE NO ACTION - Similar to RESTRICT

Unique Constraints

Check Constraints

Exclusion Constraints

Deferrable Constraints

Indexes

Basic Indexes

Index Types

Partial Indexes

Covering Indexes (PostgreSQL 11+)

Expression Indexes

Views

Regular Views

Materialized Views

Functions

PL/pgSQL Functions

SQL Functions

Function Attributes

Triggers

Row-Level Triggers

Statement-Level Triggers

Conditional Triggers

Constraint Triggers

Constraint-trigger identity, deferrability, initial timing, and optional FROM relation are preserved during extraction, diffing, and migration generation.

Custom Types

Enum Types

Composite Types

Domain Types

Extensions

Sequences

Comments

See Also