Re: Table symbolic link

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'Campbell, Lance *EXTERN*'" <lance(at)illinois(dot)edu>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Table symbolic link
Date: 2016-05-18 14:57:44
Message-ID: A737B7A37273E048B164557ADEF4A58B53851CB5@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Lance Campbell wrote:
> I have 16 web applications using a single database. Some of the tables in the database are used by
> many of the applications. I wanted to rename a particular table. The issue is that I would have to
> change every application then stop all the applications and then redeploy them after renaming the
> table to the new name.
>
> The better strategy would be to rename the table to the new name and add a symbolic table that link to
> the new table name. Then as I make changes to each application I can point them to the new name.
> Maybe in a year I could delete the symbolic table name.
>
> Is this possible? I have not seen a symbolic table name feature but I thought I would ask.
>
> If this is not currently possible it might be something to consider adding.

You can do that with a view:

BEGIN;
ALTER TABLE oldname RENAME TO newname;
CREATE VIEW oldname AS SELECT * FROM newname;
COMMIT;

Yours,
Laurenz Albe

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Albe Laurenz 2016-05-18 15:09:22 Re: Memory and Swap
Previous Message Campbell, Lance 2016-05-18 14:41:03 Re: Table symbolic link