Search Postgresql Archives

CREATE OR REPLACE MATERIALIZED VIEW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux