Move tests of contrib/spi/ out of the core regression tests

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Move tests of contrib/spi/ out of the core regression tests
Date: 2025-04-08 01:59:19
Message-ID: 3872677.1744077559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The attached patch removes test cases concerned with contrib/spi/
from the core regression tests and instead puts them into new
test files in contrib/spi/ itself.

My original motivation for looking at this was the discussion in
[1] about whether to remove contrib/spi/refint.c entirely, since
it's rather buggy and not a great example of our modern coding
practices. So I wondered whether the core test cases that use it
were contributing any significant amount of code coverage on the
core code. (Spoiler: nope.) But I think this is generally good
cleanup anyway, because it locates the test code for contrib/spi
where a person would expect to find that, and removes some rather
grotty coding in src/test/regress's Makefile and meson.build.
As a side benefit, it removes some small number of cycles from
the core tests, which seems like a good thing.

The tests for the refint module are just moved over verbatim,
except for using CREATE EXTENSION instead of manual declaration
of the C functions. Also, I kept the tests for COMMENT ON TRIGGER
in the core tests, by applying them to a different trigger.

The tests for autoinc were kind of messy, because the behavior of
autoinc itself was impossibly intertwined with the behavior of
"ttdummy", which is an undocumented C function in regress.c.
After some thought I decided we could just nuke ttdummy altogether,
so the new autoinc.sql test is much simpler and more straightforward.

(I realized while doing this that the description of autoinc in
the SGML docs is not a great description of what the function
actually does, so the patch includes some updates to those docs.)

So far as I can tell, the code coverage of the core regression
tests is unchanged by this patch: the removed test cases were
100% redundant with other cases, so far as the core is concerned.

This is too late for v18 of course, so I'll park it in the next CF.

regards, tom lane

[1] https://www.postgresql.org/message-id/flat/79755a2b18ed4fe5e29da6a87a1e00d1%40postgrespro.ru

Attachment Content-Type Size
v1-split-out-contrib-spi-tests.patch text/x-diff 43.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2025-04-08 02:00:35 RE: Fix 035_standby_logical_decoding.pl race conditions
Previous Message Sami Imseih 2025-04-08 01:58:41 Re: Proposal - Allow extensions to set a Plan Identifier