Skip to content

Consider a build-time check that test/install/*.sql sets ON_ERROR_STOP #97

Description

@jnasbyupgrade

Background

In Postgres-Extensions/cat_tools's test/install/load.sql (PR #54), \set ON_ERROR_STOP on
turned out to be load-bearing in a way that's easy to silently break: test/install/*.sql files
run in their own, self-comparing pg_regress entry (see pgxntool's own docs on the test/install
feature), so a RAISE EXCEPTION/hard-error check in one of these files only actually fails the
build if ON_ERROR_STOP is set -- without it, psql prints the error and keeps going, and nothing
ever diffs to catch it. Removing that one \set line silently turns every hard-error check in the
file into a no-op, with no test failure to reveal it.

Proposal (raised for discussion, not a confirmed ask)

Consider whether pgxntool itself should have a build-time check that every test/install/*.sql
file sets ON_ERROR_STOP before anything else that could raise an error -- e.g. a make lint-style
scan, or a check-test-install-error-stop target wired into the existing test/install feature's
own machinery. This would be generic to any pgxntool-based extension using test/install, not
cat_tools-specific.

Open question

Whether this is worth building at all -- an explicit check adds real complexity (parsing/scanning
every install file, deciding what "before anything that could error" means precisely) for a
problem that a code-review comment/convention might catch just as well. Recording the idea here
rather than committing to it; feel free to close as wontfix if the maintainers don't think it's
worth the complexity.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions