From: | Aidan Samuel <aidan(dot)samuel(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | CREATE OR REPLACE MATERIALIZED VIEW |
Date: | 2019-01-10 00:25:09 |
Message-ID: | CAAWhf=PHch2H3ekYnbafuwqWqwyRok8WVPaDxKosZE4GQ2pq5w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
[1] https://www.postgresql.org/docs/current/sql-createview.html
[2] https://www.postgresql.org/docs/current/sql-creatematerializedview.html
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-01-10 01:13:47 | Re: CREATE OR REPLACE MATERIALIZED VIEW |
Previous Message | Martín Marqués | 2019-01-09 23:43:41 | Re: postgres operational |