Skip to content

Investigate removing ncs() #54

Description

@jnasbyupgrade

ncs() (defined in test/core/functions.sql) is a SQL function the test suite uses to introspect count_nulls' actual installed schema at runtime, via a pg_extension/pg_namespace join:

CREATE FUNCTION ncs() RETURNS name IMMUTABLE LANGUAGE sql AS $$
SELECT nspname FROM pg_namespace n JOIN pg_extension x ON n.oid = x.extnamespace WHERE extname = 'count_nulls'
$$;

It's used throughout test/core/functions.sql and test/sql/extension_tests.sql to schema-qualify calls into count_nulls regardless of which schema the extension landed in for a given test run.

Separately, the test suite is moving to a design where every install always uses a single, uniquely-prefixed, randomly generated schema name (see the in-progress PR implementing this), discoverable by any script via a new test/helpers/find_test_schema.sql psql-variable-based lookup (:"test_schema"). Now that a general-purpose discovery mechanism like that exists, ncs() may be redundant, overlapping machinery worth consolidating away in favor of one consistent way of finding "the schema count_nulls is installed in" - but this hasn't been evaluated in any depth, and is NOT part of that PR's scope.

This issue is just to track that as something worth investigating later - no decision has been made yet, and this should not block or be conflated with the random-schema PR itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions