Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com> writes:
> i added locally some regressions tests for such detection, but i needed to
> add cols to tenk1 cause tenk1 has no "not null" columns nor primary keys.
> i'm too new to tell if that's the correct way to do.
It is absolutely not. In general, modifying the properties of any
of the commonly-used objects made by test_setup.sql is a bad idea.
There's too much risk of side-effects on other tests. Even if they
don't show visible output changes, the code might now be following
some other code path and thus not testing what was intended. This
seems particularly risky for changes in constraints, which might
change planner decisions.
If you need a table that's not like any existing test table, make a
new one. But in this case it seems like there are probably existing
tests that cover behavior adjacent to what you want to test. Maybe
you can re-use some of their tables and not have to expend test cycles
on building a whole new table.
regards, tom lane