I am trying to create a materialized view using different schemas in the same database. But it is not allowing me to create with the error being: "ERROR: Materialized views cannot be defined on regular or late binding views."
Below is the sql query which I use. Even if the 'schema' is within the database. It still errors out. Any idea?
SELECT DISTINCT number as id,
created_at as date,
type as dtype
FROM schema.table1
WHERE type='Y' AND table1.number NOT IN ('XXXXXXXXXX')
UNION ALL
SELECT
DISTINCT number as id,
created_at as date,
type as dtype
FROM schema.table1
WHERE type='Y' AND table1.created_at >= '2001-08-01'
UNION ALL
SELECT
DISTINCT number as id,
created_at as date,
type as dtype
FROM schema.table1
WHERE type='XXXX' AND table1.created_at >= '2001-07-11' AND table1.number NOT IN ('XXXXXXXXXX')
But the same query without 'schema' works fine and creates a Materialized View. The table from which I am creating this is not a view and Table which exists in the DB