Move warning

This commit is contained in:
Adam Guo 2025-03-04 22:25:49 +00:00
parent 7f71f7c5e7
commit 7ad10b48ef

View file

@ -273,19 +273,20 @@ IVM_prevent_immv_change(PG_FUNCTION_ARGS)
TriggerData *trigdata = (TriggerData *) fcinfo->context; TriggerData *trigdata = (TriggerData *) fcinfo->context;
Relation rel = trigdata->tg_relation; Relation rel = trigdata->tg_relation;
if (ImmvIncrementalMaintenanceIsEnabled())
return PointerGetDatum(NULL);
/* /*
* If we are maintaining an IMMV, this warning would have been emitted by * This warning is shown regardless of whether the user is manually
* the IVM_immediate_* triggers, so there is no need to emit it again. * modifying the materialized view, or the extension is performing
* incremental maintenance.
*/ */
warnIfPgIvmNotPreloaded(); warnIfPgIvmNotPreloaded();
ereport(ERROR, if (!ImmvIncrementalMaintenanceIsEnabled())
(errcode(ERRCODE_WRONG_OBJECT_TYPE), ereport(ERROR,
errmsg("cannot change materialized view \"%s\"", (errcode(ERRCODE_WRONG_OBJECT_TYPE),
RelationGetRelationName(rel)))); errmsg("cannot change materialized view \"%s\"",
RelationGetRelationName(rel))));
return PointerGetDatum(NULL);
} }
/* /*