PostgreSQL CHECK constraints may only reference the row being inserted or updated. A CHECK that compares against other rows can pass simple tests yet fail during pg_dump restore, because rows load in an order that may not satisfy it.
postgresql / constraints / check-constraint / data-integrity / dump-restore / ddl
Diagnose repeated JOIN rows by counting matching keys, checking constraints and choosing whether the result should contain orders, items or summaries.
SQL / JOIN / PostgreSQL
A closer look at explicitly deferred NO ACTION checks and clearing only the optional component of a composite foreign key. These details complement the basic choice between RESTRICT, CASCADE and SET NULL.
postgresql / foreign-key / on-delete / data-retention / cascade / restrict / set-null / referential-integrity
Compare RESTRICT, CASCADE and SET NULL using a small isolated example, then check the actual constraint and dependent rows before changing real data.
PostgreSQL / SQL / Foreign keys / Transactions
Use ON CONFLICT to atomically insert or update rows based on unique constraints. Specify the exact conflict target, handle duplicate input rows, and understand that excluded values replace, not accumulate.
postgresql / sql / upsert / insert / on-conflict / unique-constraint / concurrency / database
Use ISO timestamp strings and decimal strings, then reconstruct the fields explicitly. A complete standard-library example shows timezone checks, precision and predictable failures.
JSON / Serialization / Deserialization / Datetime / Decimal / Python / Data Contract / Type Handling
Transactions in PostgreSQL allow grouping SQL operations into atomic blocks using the commands BEGIN, COMMIT, and ROLLBACK. This ensures data integrity: either all changes are applied or none at all. The mechanism is based on ACID principles - atomicity, consistency, isolation, and durability.
PostgreSQL / transactions / BEGIN / COMMIT / ROLLBACK / ACID / savepoint