Error message for CREATE VIEW is confusing

Started by Pavel Golubover 12 years ago2 messages
#1Pavel Golub
pavel@microolap.com

Hello, PostgreSQL.

Let's assume we have created MATERIALIZED VIEW, e.g.

CREATE MATERIALIZED VIEW customer_v AS SELECT ....;

Then one wants to redefine this view as a regular view, e.g.

CREATE OR REPLACE VIEW customer_v AS ....;

Error is rising:
ERROR: "customer_v" is not a view
********** Error **********
ERROR: "customer_v" is not a view
SQL-state: 42809

Should we change error message to something like "customer_v" has wrong
object type" (according to errcode appendix)? Or should we change word
"view" to "regular view" since we have "materialized" already, e.g.
"customer_v" is not a regular view"?

--
With best wishes,
Pavel mailto:pavel@gf.microolap.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Robert Haas
robertmhaas@gmail.com
In reply to: Pavel Golub (#1)
Re: Error message for CREATE VIEW is confusing

On Wed, Jul 31, 2013 at 6:49 AM, Pavel Golub <pavel@microolap.com> wrote:

Hello, PostgreSQL.

Let's assume we have created MATERIALIZED VIEW, e.g.

CREATE MATERIALIZED VIEW customer_v AS SELECT ....;

Then one wants to redefine this view as a regular view, e.g.

CREATE OR REPLACE VIEW customer_v AS ....;

Error is rising:
ERROR: "customer_v" is not a view
********** Error **********
ERROR: "customer_v" is not a view
SQL-state: 42809

Should we change error message to something like "customer_v" has wrong
object type" (according to errcode appendix)? Or should we change word
"view" to "regular view" since we have "materialized" already, e.g.
"customer_v" is not a regular view"?

Well, this is another instance of the general problem that some people
think that "view" ought to mean "materialized view", but it doesn't.
I'm not inclined to go too crazy trying to clear up all possible
ambiguities in this area, because I think it's a rat's nest that will
never really work out well as long as people think those two things
are somehow the same. One idea is to add a hint:

HINT: It is a materialized view.

But I'm not sure whether that's a good idea or not.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers