I've discovered a bug in ALTER TABLE behaviour when it comes to
renaming a view.

I'm not sure if renaming a view is supported but Postgres will let you
do it with ALTER TABLE aview RENAME TO aview2; SELECT operations still
work on the resulting view after this command but a dump or \d aview2
will now print out :

oldplumbing=# \d t
                 View "t"
 Attribute  |       Type        | Modifier
------------+-------------------+----------
 ?column?   | text              |
 address    | character varying |
 builder    | character varying |
 subdiv     | character varying |
 plan_#     | character varying |
 sched_date | date              |
 plan_id    | integer           |
View definition: Not a view

This is obviously not correct.

-- 
chalk slayer
Wed, 8 Aug 2001 13:48:55 -0500
Ashley Clark <aclark@ghoti.org>
Bug with ALTER TABLE
* Ashley Clark in "Bug with ALTER TABLE" dated 2001/08/08 13:48 wrote:

<snip>

Duh, forgot the version #

                           version
-------------------------------------------------------------
 PostgreSQL 7.1 on i686-pc-linux-gnu, compiled by GCC 2.95.2

-- 
chalk slayer
Wed, 8 Aug 2001 13:53:36 -0500
Ashley Clark <aclark@ghoti.org>
Re: Bug with ALTER TABLE
I an confirm this is a bug.  The line:

> View definition: Not a view

is the incorrect part.


Checking application/pgp-signature: FAILURE
-- Start of PGP signed section.
> I've discovered a bug in ALTER TABLE behaviour when it comes to
> renaming a view.
> 
> I'm not sure if renaming a view is supported but Postgres will let you
> do it with ALTER TABLE aview RENAME TO aview2; SELECT operations still
> work on the resulting view after this command but a dump or \d aview2
> will now print out :
> 
> oldplumbing=# \d t
>                  View "t"
>  Attribute  |       Type        | Modifier
> ------------+-------------------+----------
>  ?column?   | text              |
>  address    | character varying |
>  builder    | character varying |
>  subdiv     | character varying |
>  plan_#     | character varying |
>  sched_date | date              |
>  plan_id    | integer           |
> View definition: Not a view
> 
> This is obviously not correct.
> 
> -- 
> chalk slayer
-- End of PGP section, PGP failed!

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Wed, 8 Aug 2001 15:21:53 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: [GENERAL] Bug with ALTER TABLE
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I an confirm this is a bug.  The line:

Presumably, ALTER RENAME is forgetting to rename the ON SELECT rule
associated with the view.  The actual use of the rule is driven by
OID-based lookups and isn't affected, but I bet that psql tries to
look up the rule by name.

			regards, tom lane

Wed, 08 Aug 2001 17:41:30 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: [GENERAL] Bug with ALTER TABLE 
Ashley Clark <aclark@ghoti.org> writes:
> I've discovered a bug in ALTER TABLE behaviour when it comes to
> renaming a view.

I've committed a fix for this.

			regards, tom lane

Sun, 12 Aug 2001 17:38:05 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Bug with ALTER TABLE 