Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: i have table


  • From: "Aaron Bono" <postgresql(at)aranya(dot)com>
  • To: "Andrew Sullivan" <ajs(at)crankycanuck(dot)ca>
  • Cc: pgsql-sql(at)postgresql(dot)org
  • Subject: Re: i have table
  • Date: Mon, 9 Oct 2006 11:01:17 -0500
  • Message-id: <bf05e51c0610090901p6d2562acwfff1b200c086ffa9(at)mail(dot)gmail(dot)com>

On 10/5/06, Andrew Sullivan <ajs(at)crankycanuck(dot)ca> wrote:
On Wed, Oct 04, 2006 at 11:20:07AM -0500, Aaron Bono wrote:
>
> So do it as needed and convert your application slowly.

You don't even need to do that.

ALTER TABLE tablename RENAME TO tablename_real;

CREATE VIEW tablename [&c.]

Now the view looks to the application just like the old table.  If
you want to insert &c., you put some rules there.


If you do this you need to make the view updateable or inserts/updates/deletes will break.

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================

Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group