mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +00:00
feat(postgres): support PostgreSQL 19
PostgreSQL 19 was released on 19.11.2026, and TREK refused it at boot as newer than the 14 to 18 it supported (discussion #3214). It now supports 14 to 19. The image installs the version 19 client tools from PGDG's main component, since the per-major component can trail a new release; a client handles every server up to its own major, so pg_dump, pg_restore and psql 19 back up and restore every supported server. The tools are looked for in the 19 directory first. Installs that pointed TREK_DB_PG_BIN_DIR at the old /usr/lib/postgresql/18/bin keep working: the image keeps that path as a link to the 19 tools. CI runs the Postgres lane on 14 and 19 instead of 14 and 18, so the job count stays the same, and the Docker job boots on 19. The list of server functions and roles that reach the host was checked against the release notes; PostgreSQL 19 adds none. The compose example stays on 18, because an existing database stays on the major it was created with.
This commit is contained in:
@@ -14,12 +14,13 @@ export type PgTool = 'pg_dump' | 'pg_restore' | 'psql';
|
||||
|
||||
/**
|
||||
* Where the client tools are looked for when `TREK_DB_PG_BIN_DIR` is unset:
|
||||
* Debian's versioned directories newest first (the Docker image installs 18),
|
||||
* Debian's versioned directories newest first (the Docker image installs 19),
|
||||
* then the usual prefixes. Newest first because a client dumps and restores
|
||||
* every server up to its own major version and refuses a newer one. Never
|
||||
* PATH: a binary is run by its absolute path.
|
||||
*/
|
||||
const DEFAULT_BIN_DIRS = [
|
||||
'/usr/lib/postgresql/19/bin',
|
||||
'/usr/lib/postgresql/18/bin',
|
||||
'/usr/lib/postgresql/17/bin',
|
||||
'/usr/lib/postgresql/16/bin',
|
||||
|
||||
@@ -38,7 +38,7 @@ import path from 'node:path';
|
||||
*
|
||||
* Which names are functions of `pg_catalog` is read from
|
||||
* `assets/postgres/catalog-functions.txt`: every function name of every
|
||||
* supported major (14 to 18; the boot refuses any other server). The Postgres
|
||||
* supported major (14 to 19; the boot refuses any other server). The Postgres
|
||||
* lane compares it with `pg_proc` on the server it runs on and fails on a
|
||||
* name missing there (PGPLUG-021), so a new major cannot add a function a
|
||||
* plugin may call without someone deciding whether it belongs here.
|
||||
|
||||
@@ -8,8 +8,8 @@ import { run } from './pg-process';
|
||||
* psql then refuses every meta-command until the matching `\unrestrict`.
|
||||
*
|
||||
* RESTRICT_SINCE holds, per major, the first minor that carries the fix, for
|
||||
* every major TREK supports (14 to 18; 18 has it from 18.0). Every major after
|
||||
* the last one listed has it from its first release.
|
||||
* the majors TREK supports from 14 to 18 (18 has it from 18.0). Every major after
|
||||
* the last one listed (19 and later) has it from its first release.
|
||||
*/
|
||||
const RESTRICT_SINCE: Readonly<Partial<Record<number, number>>> = { 14: 19, 15: 14, 16: 10, 17: 6, 18: 0 };
|
||||
const LAST_MAJOR_WITHOUT_IT = Math.max(...Object.keys(RESTRICT_SINCE).map(Number));
|
||||
@@ -46,6 +46,6 @@ export async function refuseToolsWithoutRestrict(binDir: string | undefined): Pr
|
||||
if (stale < 0) return;
|
||||
throw new Error(
|
||||
`${tools[stale]} is too old to restore safely (${versions[stale].trim()}): it must be at least ${minimumVersionsText()} ` +
|
||||
'(the Docker image has 18). Upgrade the PostgreSQL client tools or point TREK_DB_PG_BIN_DIR at newer ones.',
|
||||
'(the Docker image has 19). Upgrade the PostgreSQL client tools or point TREK_DB_PG_BIN_DIR at newer ones.',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { REFUSAL } from '../../legacy-baseline';
|
||||
*/
|
||||
|
||||
/** The PostgreSQL majors TREK supports and CI runs: the oldest and the newest. */
|
||||
const SUPPORTED_SERVER_MAJORS = { oldest: 14, newest: 18 } as const;
|
||||
const SUPPORTED_SERVER_MAJORS = { oldest: 14, newest: 19 } as const;
|
||||
|
||||
/**
|
||||
* The `pg_catalog` functions that read, list or write files on the database
|
||||
|
||||
Reference in New Issue
Block a user