Re: Mimic ALIAS in Postgresql?

From: hector vass <hector(dot)vass(at)gmail(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Mimic ALIAS in Postgresql?
Date: 2024-01-16 22:07:16
Message-ID: CAJJx+iW_qxChXWjw17f7810MMDoRdnm-hTJyucH-uhQyCG677A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 16 Jan 2024, 17:21 Ron Johnson, <ronljohnsonjr(at)gmail(dot)com> wrote:

> Some RDBMSs have CREATE ALIAS, which allows you to refer to a table by a
> different name (while also referring to it by the original name).
>
> We have an application running on DB2/UDB which (for reasons wholly
> unknown to me, and probably also to the current developer) extensively uses
> this with two schemas: MTUSER and MTQRY. For example, sometimes refer to
> MTUSER.sometable and other times refer to it as MYQRY.sometable.
>
> My goal is to present a way to migrate from UDB to PG with as few
> application changes as possible. Thus, the need to mimic aliases.
>
> Maybe updatable views?
> CREATE VIEW mtqry.sometable AS SELECT * FROM mtuser.sometable;
>

I think views will work. Alternative might be interpose a proxy to rewrite
the SQL. https://www.galliumdata.com/ gives you an idea of what this might
look like although could do a lite version yourself.

>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-01-16 22:16:14 Re: Tips on troubleshooting slow DELETE (suspect cascades)
Previous Message Tom Lane 2024-01-16 21:59:10 Re: Moving to Postgresql database