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:40:58
Message-ID: eb7f0942-ce43-4d5b-9ab7-c57b6e2c276f@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).
>

>
> Maybe updatable views?
> CREATE VIEW mtqry.sometable AS SELECT * FROM mtuser.sometable;
>

Assuming sometable is the same name in both schemas then the above will
not work as:

https://www.postgresql.org/docs/current/sql-createview.html

"The name of the view must be distinct from the name of any other
relation (table, sequence, index, view, materialized view, or foreign
table) in the same schema."

You would get a conflict with the existing table MTQRY.sometable.

Though I noticed you have both MTQRY and MYQRY referring to the same
thing, I think.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Vanns 2024-01-16 17:45:39 Tips on troubleshooting slow DELETE (suspect cascades)
Previous Message Adrian Klaver 2024-01-16 17:28:27 Re: Mimic ALIAS in Postgresql?