CREATE OR REPLACE MATERIALIZED VIEW - Mailing list pgsql-general

From Aidan Samuel
Subject CREATE OR REPLACE MATERIALIZED VIEW
Date
Msg-id CAAWhf=PHch2H3ekYnbafuwqWqwyRok8WVPaDxKosZE4GQ2pq5w@mail.gmail.com
Whole thread Raw
Responses Re: CREATE OR REPLACE MATERIALIZED VIEW  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I've been looking over the syntax for creating various database objects: tables, views, functions, etc., and I wondered why there seem to be some discrepancies.

For example, table creation syntax features [ IF NOT EXISTS ] but doesn't feature [ OR REPLACE ], function creation syntax is the inverse and has [ OR REPLACE ], but no [ IF NOT EXISTS ].

I also noticed that the syntax for creating VIEWS and creating MATERIALISED VIEWS is handled separately [1][2].

I was expecting to see one page of documentation with the syntax listed as something like: CREATE [ OR REPLACE ] [ MATERIALIZED ] VIEW [ IF NOT EXISTS ] view_name.

Is this because a materialized view is actually a table and thus inherits the table creation syntax instead of the view creation syntax?

How come table creation doesn't allow [ OR REPLACE ], and view creation doesn't allow [ IF NOT EXISTS ]? Is this just how the SQL spec defines things?

Thanks,
Aidan.


pgsql-general by date:

Previous
From: Martín Marqués
Date:
Subject: Re: postgres operational
Next
From: Tom Lane
Date:
Subject: Re: CREATE OR REPLACE MATERIALIZED VIEW