pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ron Johnson <ronljohnsonjr@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Mimic ALIAS in Postgresql?
Date: Tue, 16 Jan 2024 09:28:27 -0800
Message-ID: <935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com> (raw)
In-Reply-To: <CANzqJaCc5jVh3J3EA0j4Dz7V2HsrcR9eE0AE45pt-PmMrjhdmg@mail.gmail.com>
References: <CANzqJaCc5jVh3J3EA0j4Dz7V2HsrcR9eE0AE45pt-PmMrjhdmg@mail.gmail.com>

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.klaver@aklaver.com






view thread (19+ messages)  latest in thread

Message-ID: <935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com>
Permalink:  ../935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com/
Also on:    postgresql.org/message-id/935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, ronljohnsonjr@gmail.com
  Subject: Re: Mimic ALIAS in Postgresql?
  In-Reply-To: <935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com>
  References: <CANzqJaCc5jVh3J3EA0j4Dz7V2HsrcR9eE0AE45pt-PmMrjhdmg@mail.gmail.com> <935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox