Re: [Bug]Vacuum full silently NULL out fast default columns

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Álvaro Herrera <alvherre@kurilemu.de>, Antonin Houska <ah@cybertec.at>
Date: 2026-05-04T13:40:48Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Don't lose column values on REPACK

  2. Add CONCURRENTLY option to REPACK

SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com> writes:
> VACUUM FULL silently turns columns added via ALTER TABLE ... ADD COLUMN ...
> DEFAULT <const> into NULL
> on all pre-existing rows. The issue exists for other operations like
> CLUSTER, REPACK.

That is a seriously awful bug.  Fortunately it is not in any shipping
release.  A quick bisect run agrees that it broke here:

28d534e2ae0ac888b5460f977a10cd9bb017ef98 is the first bad commit
commit 28d534e2ae0ac888b5460f977a10cd9bb017ef98 (HEAD)
Author: Álvaro Herrera <alvherre@kurilemu.de>
Date:   Mon Apr 6 21:55:08 2026 +0200

    Add CONCURRENTLY option to REPACK

> Patch attached. Added a regression test in fast_default.sql covering
> VACUUM FULL, CLUSTER, and REPACK on a table with fast-default columns
> including a NOT NULL CHECK column.

I don't know if this is the best code fix (I don't like putting extra
checks into a loop condition like this).  But I agree we need some
more tests covering this area.

			regards, tom lane