Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPnEn-00EBhs-F9 for pgsql-general@arkaria.postgresql.org; Tue, 16 Jan 2024 17:28:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rPnEm-005lJ1-IK for pgsql-general@arkaria.postgresql.org; Tue, 16 Jan 2024 17:28:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPnEm-005lIs-81 for pgsql-general@lists.postgresql.org; Tue, 16 Jan 2024 17:28:32 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPnEj-001qke-QZ for pgsql-general@postgresql.org; Tue, 16 Jan 2024 17:28:31 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 08A865C01D8; Tue, 16 Jan 2024 12:28:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 16 Jan 2024 12:28:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1705426109; x=1705512509; bh=waOxFm8utnoiaCSJ98w6BVNTQc300QRIgFTbRqPkfNg=; b= azFCcMy1ObivXMd1DjxOgvyxl73CBICXNdeIZoW3vPtImnGI4pd9OvzLcDByqNb5 d2gfH73rHe7AG4DzHygXYgJi4AnbWxIWr1H0Ybxs+PaN5dV9ugcGzIwL1Un1EKve WqeyoGCjuC7w4B3MDysbbciJYhaZJ7n7nbezIcG74tRvunjsVZv2dilv49PIKUG0 51tf+n5ZavPfaDosdxEa1iuSLguktSwWokYaq6+drhOSC9Y34boyK/V41ktKU1TG qppL2eBuQ1jbKSC80Sgld0BX1GOg5XHi+Igms5bCyUNu7aTB1UGC2OEeDaUB9GaJ LPMHwgg3/Zyk60R4CRWulA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1705426109; x= 1705512509; bh=waOxFm8utnoiaCSJ98w6BVNTQc300QRIgFTbRqPkfNg=; b=u BOtIJXrVxDaUK9GzQJ9L1sIzNeZUfhAcVz54m2lpnFcvhntkFdGdra2vQF3k8/lq UNWWQX54/AkYrs9wUdgVvW/Uaxnh54OOSsRjS57tCivZc7CgzZCYgQZeNb740snv YTd8HNRed5frDp/pnGWDlvP6xuX5XFFcaYI3Xx2IKtz1V+xjscAP2C/ERSeHX3Xt uat3f88R1Waj9Ug8nUnUhIs0iuWdOcqDeiGSh5HEHVDqcvFgMr5fp2rZQybVJ1Q7 GubUA0UoAb1qr0o5x3HjwTwYQfybUBv+paLN4/XOqrsxxgXLrvoB0Tvztus2UUTi N2GDxzwAVQ65AdsaiSH5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdejfedguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesth ekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeffleegie efgfevudehtdfhkeeutdffjeevgeffgeejvedthefgudeiteefheejheenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Jan 2024 12:28:28 -0500 (EST) Message-ID: <935f8e0b-2247-4d8e-88fe-e7dd134dea1d@aklaver.com> Date: Tue, 16 Jan 2024 09:28:27 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Mimic ALIAS in Postgresql? Content-Language: en-US To: Ron Johnson , pgsql-general References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 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. 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