Re: Mimic ALIAS in Postgresql?

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Mimic ALIAS in Postgresql?
Date: 2024-01-17 00:39:20
Message-ID: 3001c3b8-6845-4f3a-a9a4-55c201ddfd86@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/16/24 17:03, Ron Johnson wrote:
> On Tue, Jan 16, 2024 at 5:57 PM Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
> On 1/16/24 15:39, Ron Johnson wrote:
>> On Tue, Jan 16, 2024 at 5:31 PM Rob Sargent
>> <robjsargent(at)gmail(dot)com> wrote:
>>
>> On 1/16/24 10: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.
>>>
>>> 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;
>>>
>> Isn't it time to get rid of that debt?  A sed -i
>> 's/MTUSER/MTQRY/g' (or vice versa) ends what looks to me to
>> be a split brain problem.  All the sql is in git right? :)
>>
>> Or perhaps you have to beef the sed up to use word boundaries
>> just in case.
>>
>>
>> I'm not a Java web developer... 😁
>
> You need to adjust you glasses if that's what you see me as.
>
> You're the one who apparently sees me as having any control over
> anything except when the backups run. 😞

You could lie to DEV  and say the smart people on the pg list suggest
sed ;).  Better yet tell his PM!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2024-01-17 00:41:33 Re: Mimic ALIAS in Postgresql?
Previous Message Jim Nasby 2024-01-17 00:39:01 Re: Mimic ALIAS in Postgresql?