PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15384
PG Version9.6.1
OSWindows
Opened2018-09-14 09:40:39+00
Reported byTerence Zekveld
StatusWon't Fix

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15384
Logged by:          Terence Zekveld
Email address:      (redacted)
PostgreSQL version: 9.6.1
Operating system:   Windows
Description:        

Sometimes we change a view to a materialized view.

We have a general upgrading script to update all our postgres db's to keep
them in sync.

So I like to add this to my general upgrading script before creating the
materialized view:

DROP VIEW IF EXISTS theschema.theviewname;                             --
for in case this db still has the 'un'materialized view
DROP MATERIALIZED VIEW IF EXISTS theschema.theviewname;  -- for in case this
db already has an older version of the materialized view
CREATE MATERIALIZED VIEW theschema.theviewname AS ...

But either the 1st or the 2nd DROP functions throw an error, either
"theschema.theviewname is not a view" or "theschema.theviewname is not a
materialized view".

I would think these errors are not relevant when using the "IF EXISTS"
option, i.e. it should execute both, 'skipping' the one that refers to the
incorrect type of view...

Kind regards, and thanks for a great db,
Terence

Messages

DateAuthorSubject
2018-09-14 09:40:39+00=?utf-8?q?PG_Bug_reporting_form?=BUG #15384: dropping views and materialized views
2018-09-14 12:54:45+00Merlin MoncureRe: BUG #15384: dropping views and materialized views
2018-09-14 14:07:15+00Terence ZekveldRE: BUG #15384: dropping views and materialized views
2018-09-14 14:41:56+00Tom LaneRe: BUG #15384: dropping views and materialized views
2018-09-18 10:32:02+00Terence ZekveldRE: BUG #15384: dropping views and materialized views