Remove useless asserts in report_namespace_conflict()
authorMichael Paquier <michael@paquier.xyz>
Sun, 18 Jan 2026 07:11:46 +0000 (16:11 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sun, 18 Jan 2026 07:11:46 +0000 (16:11 +0900)
An assertion is used in this routine to check that a valid namespace OID
is given by the caller, but it was repeated twice: once at the top of
the routine and a second time multiple times in a switch/case.  This
commit removes the assertions within the switch/case.

Thinko in commit 765cbfdc9263.

Author: Man Zeng <zengman@halodbtech.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/tencent_40F8C1D82E2EE28065009AAA@qq.com

src/backend/commands/alter.c

index f7b2389b019cc3dd78ff609edf06cdc95a2d2937..08957104c70a2144936bfa7d243f6a47c67662de 100644 (file)
@@ -117,27 +117,21 @@ report_namespace_conflict(Oid classId, const char *name, Oid nspOid)
    switch (classId)
    {
        case ConversionRelationId:
-           Assert(OidIsValid(nspOid));
            msgfmt = gettext_noop("conversion \"%s\" already exists in schema \"%s\"");
            break;
        case StatisticExtRelationId:
-           Assert(OidIsValid(nspOid));
            msgfmt = gettext_noop("statistics object \"%s\" already exists in schema \"%s\"");
            break;
        case TSParserRelationId:
-           Assert(OidIsValid(nspOid));
            msgfmt = gettext_noop("text search parser \"%s\" already exists in schema \"%s\"");
            break;
        case TSDictionaryRelationId:
-           Assert(OidIsValid(nspOid));
            msgfmt = gettext_noop("text search dictionary \"%s\" already exists in schema \"%s\"");
            break;
        case TSTemplateRelationId:
-           Assert(OidIsValid(nspOid));
            msgfmt = gettext_noop("text search template \"%s\" already exists in schema \"%s\"");
            break;
        case TSConfigRelationId:
-           Assert(OidIsValid(nspOid));
            msgfmt = gettext_noop("text search configuration \"%s\" already exists in schema \"%s\"");
            break;
        default: