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 1rPtxn-00F2hS-4r for pgsql-general@arkaria.postgresql.org; Wed, 17 Jan 2024 00:39:27 +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 1rPtxm-009N5V-BT for pgsql-general@arkaria.postgresql.org; Wed, 17 Jan 2024 00:39:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPtxm-009N4s-0J for pgsql-general@lists.postgresql.org; Wed, 17 Jan 2024 00:39:26 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rPtxj-002Cm5-PI for pgsql-general@lists.postgresql.org; Wed, 17 Jan 2024 00:39:25 +0000 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3bd8cd40a04so590038b6e.0 for ; Tue, 16 Jan 2024 16:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705451962; x=1706056762; darn=lists.postgresql.org; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=CjgZfuzVwQPb1LzIq5VZHXP0q8LuMm7AE0QvM9Th+JU=; b=a8beLdSU1PLe/btE9weq1kjk/VasMhvMWXT0pas9NE+jkW5fMtL5D2K9uoLp7z0Ers cEK4jNeGmg3MQYGQe0FpahBeOt/Sy7VjFY3qmgh6BfcOWbjK3Jy9m86G3vLzY4Yv3xB3 G1vcx4DTb8wqO/LMZJdsotrsDIdhfwDyAx3dSdEeRUx5ZUq9VJcDc98S8ubIf7W02lIy /wU25tQTSHP98ELjtplAjKikTsloDbcZgGU6lfpKinXvm2bkxzWdMuVunCsgHxFU6vlE ai4sNQ47auddfn42V9QNUF6SZXUVmmRFdYnsuEaJTwIyuFUwUREl7fh9sCjwXi3xwlpw wC4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705451962; x=1706056762; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=CjgZfuzVwQPb1LzIq5VZHXP0q8LuMm7AE0QvM9Th+JU=; b=qV9t7bj8/RiaMMqYFFjOqBvLNUvxnekFffggsDS6g8+sfiBDslY4AeueUbX0Ja0NmE pq/xESfvO/1FkgFUeHV3Eaa9IH6VuLEwR+WAJppWWCx54WlDe8SSevlGldhNB1qBVd6l wsaDs4WyEBNJTmlin4Tf1S2cQ8bwLL3XFx6d+6w5BJU/T5hobrMCsNbEBl3NLOKCLJf1 PqvxQl+Rjgb/oWZpv5jptqOjcpoF5ZTd/YzjvzhxQfzU2xlU1pbP9cWMiAjgAgCT+v1F 9VkE5imgaxhxu1atnuHcVpSHfXIzk+rANELD83iUzdlVHhTRTwt5GddJi4pvbBv9ttPQ N3Og== X-Gm-Message-State: AOJu0Yx7p/wgbGtVsqrlQgOWQyDgkSYESU2k25tbw0GBT9yUhsgw0Ju4 6q5+r8JyjuGXWpiIY75b9IM4gV4vQ3A= X-Google-Smtp-Source: AGHT+IF0kdudrNT2h1cniEhwt+anaJmVX3zOxHdH0TkUzSqpFps6dSm4EkYNF+HhDufJT8SvofL51A== X-Received: by 2002:a05:6808:3090:b0:3bd:93c5:d6c4 with SMTP id bl16-20020a056808309000b003bd93c5d6c4mr252214oib.83.1705451962055; Tue, 16 Jan 2024 16:39:22 -0800 (PST) Received: from [192.168.1.3] (c-76-140-27-218.hsd1.ut.comcast.net. [76.140.27.218]) by smtp.gmail.com with ESMTPSA id e6-20020a056a0000c600b006d9abe929desm181503pfj.67.2024.01.16.16.39.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jan 2024 16:39:21 -0800 (PST) Content-Type: multipart/alternative; boundary="------------0afZ4wLlg6xzn00a5hIc5TwJ" Message-ID: <3001c3b8-6845-4f3a-a9a4-55c201ddfd86@gmail.com> Date: Tue, 16 Jan 2024 17:39:20 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Mimic ALIAS in Postgresql? Content-Language: en-CA To: Ron Johnson Cc: pgsql-general@lists.postgresql.org References: <484b48cd-3a6e-4585-be9b-febed445e18b@gmail.com> From: Rob Sargent In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------0afZ4wLlg6xzn00a5hIc5TwJ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/16/24 17:03, Ron Johnson wrote: > On Tue, Jan 16, 2024 at 5:57 PM Rob Sargent wrote: > > On 1/16/24 15:39, Ron Johnson wrote: >> On Tue, Jan 16, 2024 at 5:31 PM Rob Sargent >> 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! --------------0afZ4wLlg6xzn00a5hIc5TwJ Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 1/16/24 17:03, Ron Johnson wrote:
On Tue, Jan 16, 2024 at 5:57 PM Rob Sargent <robjsargent@gmail.com> wrote:
On 1/16/24 15:39, Ron Johnson wrote:
On Tue, Jan 16, 2024 at 5:31 PM Rob Sargent <robjsargent@gmail.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!


--------------0afZ4wLlg6xzn00a5hIc5TwJ--