Skip to content
ToolShedby Wasim Shaikh

PostgreSQL 19 Released: REPACK CONCURRENTLY, ON CONFLICT DO SELECT and an Upgrade Checklist

Wasim · 23 Nov 2026

What Shipped on November 19?

The PostgreSQL Global Development Group released PostgreSQL 19 on Thursday, November 19, 2026. The release notes carry the same date.

Most coverage leads with one feature: REPACK (CONCURRENTLY), which removes table bloat without blocking reads or writes. Some smaller changes will matter more to an application developer day to day. You get a real get-or-create in one statement, COPY straight to JSON, and logical replication you can switch on without a restart.

This guide covers the features I'd actually use and the incompatibilities that can trip up an upgrade. It ends with a checklist.

As with every major version, moving from an earlier release needs a dump and restore (pg_dumpall), pg_upgrade, or logical replication. The release notes say so in their migration section.


REPACK Replaces VACUUM FULL and CLUSTER

REPACK reclaims space from a bloated table and can reorder its rows to match an index. The announcement calls it the replacement for VACUUM FULL and CLUSTER. Both old commands still work for compatibility.

The REPACK reference page gives this synopsis:

REPACK [ ( option [, ...] ) ] [ table_and_columns [ USING INDEX [ index_name ] ] ]
REPACK [ ( option [, ...] ) ] USING INDEX

-- option: VERBOSE | ANALYZE | CONCURRENTLY [ boolean ]

And these two examples:

REPACK employees;

REPACK (CONCURRENTLY) employees USING INDEX;

What CONCURRENTLY actually costs you

Without CONCURRENTLY, REPACK holds an ACCESS EXCLUSIVE lock for the whole run, the same pain as VACUUM FULL. With it, most of the work runs under SHARE UPDATE EXCLUSIVE. ACCESS EXCLUSIVE is taken only for the final swap, so it is usually held briefly.

Read the restrictions before you schedule it on a production table. The reference page lists them:

  • Primary key or replica identity required. It won't run on a table with no primary key and no index-based replica identity.
  • Not every table qualifies. It won't run on partitioned tables, UNLOGGED tables, materialized views, system catalogs, TOAST tables, or tables whose access method isn't heap.
  • No transaction blocks. You can't run it inside a transaction block, and the form without a table name can't use CONCURRENTLY.
  • It needs a replication slot. It uses logical decoding, so it fails if max_repack_replication_slots doesn't allow another slot.
  • It needs disk. Captured changes are stored on disk while it runs.
  • It can fail on write-heavy tables. It fails if more than about 104 million rows are updated or deleted during the run, and DDL from other sessions can also make it fail.
  • It is not MVCC-safe. After it commits, a transaction using a snapshot taken before the repack started may see the table as empty.

The last point matters if you run long reporting transactions or pg_dump alongside it. Schedule around them.


Developer Features Worth Using

Get-or-create with ON CONFLICT DO SELECT

Until now, "insert this row or give me the existing one" took either a CTE or a no-op DO UPDATE just to make RETURNING fire. PostgreSQL 19 adds a third conflict action, DO SELECT. This example comes straight from the INSERT reference:

INSERT INTO distributors (did, dname) VALUES (11, 'Global Electronics')
    ON CONFLICT (did) DO SELECT
    RETURNING *;

You can also lock the existing row while you're at it:

INSERT INTO distributors (did, dname) VALUES (13, 'Advanced Systems')
    ON CONFLICT (did) DO SELECT FOR UPDATE
    RETURNING *;

The synopsis allows FOR UPDATE, FOR NO KEY UPDATE, FOR SHARE or FOR KEY SHARE, plus an optional WHERE condition. If your ORM writes upserts for you, check whether it uses the new form before you change hand-written SQL.

COPY straight to JSON

COPY TO now accepts FORMAT json. Add FORCE_ARRAY and the whole output is one JSON array. Here is the example from the COPY reference:

COPY (SELECT * FROM (VALUES(1),(2)) val(id)) TO STDOUT (FORMAT JSON, FORCE_ARRAY);
[
 {"id":1}
,{"id":2}
]

Two gotchas from the docs. JSON format is allowed only in COPY TO, not COPY FROM. And a SQL NULL and a JSON-literal null both come out as null, so you can't tell them apart in the output. To inspect an export, paste it into the JSON viewer or JSON prettifier. If someone needs it in a spreadsheet, the JSON to CSV converter will flatten it.

Smaller SQL additions

The announcement and release notes also list:

  • More SQL/JSON path string methods: lower(), upper(), replace(), split_part() and btrim().
  • IGNORE NULLS in window functions: lead(), lag(), first_value(), last_value() and nth_value() now accept IGNORE NULLS (or RESPECT NULLS).
  • Random dates: random() can generate dates and timestamps within a range.
  • Password expiry warnings: password_expiration_warning_threshold warns users before their password expires. The default is seven days.

Replication and Operations Changes

  • Logical replication without a restart. The effective WAL level is raised to logical when the first logical replication slot is created. Check it with the new effective_wal_level setting.
  • Sequences replicate. CREATE PUBLICATION accepts FOR ALL SEQUENCES. It also gains an EXCEPT clause for leaving tables out of FOR ALL TABLES.
  • Read-your-writes on replicas. The announcement describes a WAIT FOR LSN command that makes a standby session wait until it has replayed WAL up to a given LSN. That's useful when a write goes to the primary and the next read goes to a replica.
  • Plan pinning. The pg_plan_advice extension pins plan choices with a "plan advice" mini-language. pg_stash_advice stores that advice and applies it by query identifier, so you can fix a slow plan without changing the application.
  • Autovacuum. Autovacuum can vacuum indexes with parallel workers (autovacuum_max_parallel_workers). A new pg_stat_autovacuum_scores view shows how it ranks tables.
  • SNI. One server can present a different TLS certificate per hostname, configured in the new pg_hosts.conf.
  • Faster bulk loads. Foreign key checks are faster. The project reports bulk inserts nearly 2x faster in its testing.

Incompatibilities That Can Break an Upgrade

These come from section E.1.2 of the release notes. I've grouped them by how likely they are to bite a typical app.

Check these first

  • standard_conforming_strings is always on. Dumps made by a pre-19 pg_dump while it was off may not load, and escape_string_warning is gone. If you restore old dumps, test one now.
  • MD5 passwords now warn. A successful MD5 login logs a warning, which you can silence with md5_password_warnings. MD5 was deprecated in 18 and will be removed in a future release, so plan the move to SCRAM using the password authentication docs.
  • RADIUS authentication is removed.
  • JIT is off by default. If you run many large analytical queries, turn it back on and compare.
  • max_locks_per_transaction changed. The default went from 64 to 128, and lock allocation changed with it. If you set it yourself, the notes say you effectively need to double your old value to keep the same capacity.
  • io_workers is removed. It's replaced by io_min_workers, io_max_workers, io_worker_idle_timeout and io_worker_launch_interval. A config file that still sets io_workers needs editing.

Reindex after upgrading

  • Full text search and pg_trgm now classify characters using the database's locale provider instead of always using libc. Reindex affected indexes and recompute stored tsvector values.
  • fuzzystrmatch changed how dmetaphone(), soundex(), metaphone() and difference() treat letters. Reindex anything built on them.
  • btree_gist inet/cidr indexes can exclude rows that should be returned, and pg_upgrade refuses clusters that have them.

Behaviour and monitoring changes

  • json_array() with no rows now returns an empty array instead of NULL.
  • COPY FROM ... WHERE no longer accepts system columns.
  • postgres_fdw now passes READ ONLY to the remote session, so read-only transactions can no longer modify rows through it.
  • Database, role and tablespace names can no longer contain carriage returns or line feeds. pg_upgrade rejects clusters that use them.
  • Dashboards may need updates. pg_stat_subscription_stats.sync_error_count is now sync_table_error_count. Wait event type BUFFERPIN is now BUFFER, and BufferContent is split into three events.
  • MULE_INTERNAL encoding is removed. A database using it has to be dumped and restored with another encoding.

Upgrade Checklist

  1. Read the migration notes. Section E.1.2 of the release notes is the source; this article is a summary.
  2. Search your config. Look for io_workers, max_locks_per_transaction and anything that relies on JIT.
  3. Audit authentication. Find MD5 and RADIUS in pg_hba.conf, and move MD5 users to SCRAM.
  4. Test-restore an old dump. Use one made by your current pg_dump and load it into a 19 instance.
  5. Do a pg_upgrade --check run. Try it on a copy. It flags btree_gist inet/cidr indexes and names with line breaks.
  6. Plan reindexes. Budget time for full text search, pg_trgm and fuzzystrmatch indexes after the upgrade.
  7. Update monitoring. Fix queries that use the renamed columns and wait events.
  8. Adopt new features later. Once you're stable on 19, try ON CONFLICT DO SELECT, COPY ... FORMAT json and REPACK (CONCURRENTLY).

Downloads are on the PostgreSQL download page. For how long 19 will be supported, see the project's versioning policy.


Wasim Shaikh

About the author

Wasim Shaikh is a UI/UX developer and front-end engineer with 15+ years of experience, based in Ahmedabad, India. He specializes in Liferay, React, Angular, Next.js and Tailwind CSS.

Keep reading

Web dev · 23 Nov 2026GitHub Event Streams and gh event listen: Stop Polling Pull Requests in Scripts and AI AgentsWeb dev · 22 Nov 2026Paper.design vs Figma vs Penpot for DevelopersWeb dev · 16 Nov 2026Node.js November 11, 2026 Security Release: 16 HTTP/2 and TLS CVEs, Upgrade to 26.13.1, 24.22.3 or 22.23.5