Error "is not a table or materialized view" when creating a unique index on a materialized view on PostgreSQL 9.5.10

From: "Sterpu Victor" <victor(at)caido(dot)ro>
To: pgsql-admin(at)postgresql(dot)org
Subject: Error "is not a table or materialized view" when creating a unique index on a materialized view on PostgreSQL 9.5.10
Date: 2020-02-06 09:03:28
Message-ID: em2fa190be-aa30-4ab6-9228-10879ac31b8b@victor-pc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello

I have PostgreSQL 9.5.10 and when I receive the error: <table> is not a
table or materialized view when I try to create a unique index on a
materialized view.

These are the SQL commands:
CREATE MATERIALIZED VIEW public.focg_uni AS
SELECT f.nrfo,
to_char(min(fd.validfrom), 'YYYY'::text) AS anul_internarii
FROM focg f
JOIN focgdepartment fd ON fd.idfocg = f.id
GROUP BY f.nrfo
WITH DATA;

REFRESH MATERIALIZED VIEW public.focg_uni

CREATE UNIQUE INDEX focg_uni_check_index ON focg_uni_check(nrfo, an);

ERROR: "focg_uni_check" is not a table or materialized view
********** Error **********

ERROR: "focg_uni_check" is not a table or materialized view
SQL state: 42809

Thank you

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Sterpu Victor 2020-02-06 09:05:21 Re: Error "is not a table or materialized view" when creating a unique index on a materialized view on PostgreSQL 9.5.10
Previous Message Justin Lu 2020-02-03 19:30:55 Re: Heavy LWLockTranche buffer_mapping in Postgres 9.6.10 server