Agent Wranglers

Recommended Open source

Use PostgreSQL for the main database

Keep the main business data of a web app in PostgreSQL, on a major version with more than 12 months of support left.

Cost

Open source. PostgreSQL Licence, free to run on your own servers. Managed hosting from every large cloud is paid.

How to do it

PostgreSQL has shipped under that name since 1996. Version 18 came out on 25 September 2025, and its current minor release is 18.6. Each major version gets five years of fixes, so 18 is supported until 14 November 2030. It was the most used database in the Stack Overflow Developer Survey 2025, at 55.6% of all respondents. It runs under the PostgreSQL Licence, which the OSI approves. Every large cloud sells it as a managed service, and pg_dump gives you a plain SQL copy to leave with. Run it as the data playbook says, with connection pooling and point-in-time recovery. Choose something else when a working MySQL or SQL Server database already holds the data, or when one small app fits in SQLite.

Examples

Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

YAML example

# compose.yaml for local development
services:
  db:
    image: postgres:18.6
    environment:
      POSTGRES_DB: shop
      POSTGRES_PASSWORD_FILE: /run/secrets/db_password
    volumes:
      - db-data:/var/lib/postgresql
volumes:
  db-data:

JavaScript example

import pg from 'pg';

const MIN_SUPPORTED_MAJOR = 15;
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
const { rows } = await pool.query('SHOW server_version_num');
const major = Math.floor(Number(rows[0].server_version_num) / 10_000);
if (major < MIN_SUPPORTED_MAJOR) throw new Error(`PostgreSQL ${major} leaves support soon`);

Python example

import os
import psycopg

MIN_SUPPORTED_MAJOR = 15

with psycopg.connect(os.environ["DATABASE_URL"]) as conn:
    major = conn.info.server_version // 10_000
    if major < MIN_SUPPORTED_MAJOR:
        raise RuntimeError(f"PostgreSQL {major} leaves support soon")

How to check

SHOW server_version on every environment returns the current minor release of a major version. The versioning page lists that major's end of life more than 12 months after today.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/databases-and-storage/postgresql. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.