Subject: Re: "define view question" ( Another problem ? )

From: [email-masked]
Date: Mon, 25 Apr 94 20:31:39 EDT

Hi:

Thanks to all who gave me "tips", well I  still cant get rid of the
view "demo". However I was able to create another view and delete it
with the command "remove view ..."

I am using postgres 4.1. Here is my output.

-- Niranjan

[pollux] monitor
Welcome to the C POSTGRES terminal monitor

Go 
* remove rule demo \g

Query sent to backend is "remove rule demo "
WARN:Apr 25 20:26:37:prs2GetRuleEventRel: rule "demo" not found

Go 
* remove view demo \g

Query sent to backend is "remove view demo "
WARN:Apr 25 20:26:47:RewriteGetRuleEventRel: class 340384 not found

Go 
* define view demo ( s.sname ) \g

Query sent to backend is "define view demo ( s.sname ) "
WARN:Apr 25 20:27:03:Attempt to insert rule '_RETdemo' failed: already exists

Go 
* \q
I live to serve you.
[pollux]

---

From: [email-masked] (Paul M. Aoki)
Date: Mon, 25 Apr 94 17:53:16 -0700

> WARN:Apr 25 20:26:47:RewriteGetRuleEventRel: class 340384 not found

views are
	- a rewrite (not instance) rule -- "define rule" and "remove 
	rule" default to instance rules
	- some other misc. catalog entries that define a fake table
	called "demo"
i would guess that in the process of trying to execute other commands
(perhaps "destroy demo") you removed the pg_class entry for "demo".

it's hard to say how to fix it without really knowing exactly what
you've already tried.  but
	remove rewrite rule _RETdemo
would probably be a good start.  if you can't do that, then you
probably did do a "destroy", and you would have to fall back to
	delete pg_rewrite where pg_rewrite.rulename = "_RETdemo"
(at least, i hope you did "destroy" instead of randomly removing
pg_class and pg_attribute tuples.)

in any event, remove view is the safe way to do it.  i stuck a
man page for it into the 4.2 reference manual so that will go out
with the final release (which will go out when we get solaris 
compilers, which will be soon i hope).
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki