Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4D4D29FA2A7 for ; Mon, 9 Oct 2006 13:01:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 51515-03 for ; Mon, 9 Oct 2006 13:01:27 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.183]) by postgresql.org (Postfix) with ESMTP id 97D249FB29D for ; Mon, 9 Oct 2006 13:01:24 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so2314961pyd for ; Mon, 09 Oct 2006 09:01:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=nUpVCACRZrSCxu5Pt+sGQw01HgswS6nY5czdNZ7nDo4UOuYS0OrIQBOcZjVrDqgOJmzOw5HHjI3Zf5KQJefAi21l87hwLq78CM+mx7wXGsCE/5P4KKLQxH8iq4K8WTmOpEwr7lHU6fpJ9rbSavXY1l67NFwvntsEfky468DLPOk= Received: by 10.35.80.20 with SMTP id h20mr3249707pyl; Mon, 09 Oct 2006 09:01:22 -0700 (PDT) Received: by 10.35.78.6 with HTTP; Mon, 9 Oct 2006 09:01:17 -0700 (PDT) Message-ID: Date: Mon, 9 Oct 2006 11:01:17 -0500 From: "Aaron Bono" To: "Andrew Sullivan" Subject: Re: i have table Cc: pgsql-sql@postgresql.org In-Reply-To: <20061005152952.GA8826@phlogiston.dyndns.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_35399_12006005.1160409677541" References: <45237D6E.1030601@logix-tt.com> <4523C3E2.4010300@myemma.com> <4523D51F.4070208@myemma.com> <20061005152952.GA8826@phlogiston.dyndns.org> X-Google-Sender-Auth: 12e8937ca11a3bec X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.602 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/93 X-Sequence-Number: 26482 ------=_Part_35399_12006005.1160409677541 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/5/06, Andrew Sullivan 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 ================================================================== ------=_Part_35399_12006005.1160409677541 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/5/06, Andrew Sullivan <ajs@crankycanuck.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
================================================================== ------=_Part_35399_12006005.1160409677541--