[PATCH] Remove unused include from analyze.c

Started by Dongpo Liuabout 2 months ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t252990
psql -h localhost -U postgres

Built from patchset v4 (message #4), August 23, 2026 at 07:08 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t252990_4 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t252990_4 && git checkout t252990_4

Patchset v4 (message #4) is on t252990_4

Jump to latest
#1Dongpo Liu
poe.liu@pm.me

Hi hackers,

While reading the ANALYZE code, I noticed that
src/backend/commands/analyze.c still includes storage/procarray.h,
but nothing in the file uses it anymore.

Commit 284925508ae removed the call to
GetOldestNonRemovableTransactionId() from acquire_sample_rows(), which
was the last reference to anything declared in that header. The #include
was left behind.

The attached patch removes it. The file compiles cleanly without it,
and I verified that no other symbol from procarray.h is referenced there.

Regards,
Dongpo Liu

Attachments:

v1-0001-Remove-unnecessary-include-storage-procarray.h.patchapplication/octet-stream; name=v1-0001-Remove-unnecessary-include-storage-procarray.h.patchDownload+0-2
#2Quan Zongliang
quanzongliang@yeah.net
In reply to: Dongpo Liu (#1)
Re: [PATCH] Remove unused include from analyze.c

On 7/5/26 9:27 PM, Dongpo Liu wrote:

Hi hackers,

While reading the ANALYZE code, I noticed that
src/backend/commands/analyze.c still includes storage/procarray.h,
but nothing in the file uses it anymore.

Commit 284925508ae removed the call to
GetOldestNonRemovableTransactionId() from acquire_sample_rows(), which
was the last reference to anything declared in that header. The #include
was left behind.

The attached patch removes it. The file compiles cleanly without it,
and I verified that no other symbol from procarray.h is referenced there.

Agree.

Furthermore, I also discovered that there are other files that contain
this unnecessary references. Please take a look at the new patch in the
attachment.

--
Quan Zongliang

Attachments:

t252990_2
v2-0001-Remove-unnecessary-include-storage-procarray.h.patchtext/plain; charset=UTF-8; name=v2-0001-Remove-unnecessary-include-storage-procarray.h.patchDownload+0-7
#3Daniel Gustafsson
daniel@yesql.se
In reply to: Quan Zongliang (#2)
Re: [PATCH] Remove unused include from analyze.c

On 23 Jul 2026, at 04:23, Quan Zongliang <quanzongliang@yeah.net> wrote:
On 7/5/26 9:27 PM, Dongpo Liu wrote:

The attached patch removes it. The file compiles cleanly without it,
and I verified that no other symbol from procarray.h is referenced there.

Agree.

Furthermore, I also discovered that there are other files that contain this unnecessary references. Please take a look at the new patch in the attachment.

This version doesn't seem to work.

../contrib/amcheck/verify_heapam.c:773:5: error: call to undeclared function 'TransactionIdIsInProgress'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
TransactionIdIsInProgress(curr_xmin))
^
../contrib/amcheck/verify_heapam.c:2168:12: error: call to undeclared function 'TransactionIdIsInProgress'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
else if (TransactionIdIsInProgress(xid))
^
2 errors generated.

--
Daniel Gustafsson

#4Quan Zongliang
quanzongliang@yeah.net
In reply to: Daniel Gustafsson (#3)
Re: [PATCH] Remove unused include from analyze.c

On 7/29/26 7:46 PM, Daniel Gustafsson wrote:

This version doesn't seem to work.

Sorry, it's my fault.
Only affects src/backend/replication/logical/logicalctl.c.
Please refer to the attachment.

--
Quan Zongliang

Attachments:

t252990_4
v3-0001-Remove-unnecessary-include-storage-procarray.h.patchtext/plain; charset=UTF-8; name=v3-0001-Remove-unnecessary-include-storage-procarray.h.patchDownload+0-2