Re: Mimic ALIAS in Postgresql?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Mimic ALIAS in Postgresql?
Date: 2024-01-16 17:28:27
Message-ID: 935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/16/24 09:20, Ron Johnson 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.

Just to be clear the table name <sometable> is the same in each schema,
correct?

In other words setting search_path would only help if was set per
session depending on which schema.<sometable> you wanted to access.

>
> 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;
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-01-16 17:40:58 Re: Mimic ALIAS in Postgresql?
Previous Message Dominique Devienne 2024-01-16 17:23:12 Re: Moving to Postgresql database