Subject: Materialized views and check constraints

From: [email-masked]
Date: Thu, 4 Apr 2024 13:25:11 -0400

Hi,

Is there any way to add check constraints to a materialized view, or plans
to add this feature in the future?

Attempting to use "ALTER TABLE tablename ADD CHECK(...)" or "ALTER
MATERIALIZED VIEW" result in error:

ERROR:  "tablename" is not a table or foreign table

Check constraints are used by the optimizer, eg for partition removal, so
this would be a useful feature to me.

--
Daniel