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 1snhgQ-005UX2-Es for pgsql-general@arkaria.postgresql.org; Mon, 09 Sep 2024 16:56:11 +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 1snhgP-00FLdg-0D for pgsql-general@arkaria.postgresql.org; Mon, 09 Sep 2024 16:56:09 +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 1snhgO-00FLdY-LR for pgsql-general@lists.postgresql.org; Mon, 09 Sep 2024 16:56:08 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snhgJ-000Kdq-0W for pgsql-general@lists.postgresql.org; Mon, 09 Sep 2024 16:56:07 +0000 Message-ID: Date: Mon, 9 Sep 2024 19:56:00 +0300 MIME-Version: 1.0 Subject: Re: postgresql FDW vs dblink for DDL To: Tom Lane , Adrian Klaver Cc: "pgsql-general@lists.postgresql.org" References: <1a884667-8474-dd01-d55f-1135724912f5@cloud.gatewaynet.com> <4efd9c6b-4021-4230-8463-d22a3d23f06c@aklaver.com> <3152670.1725896400@sss.pgh.pa.us> Content-Language: en-US From: Achilleas Mantzios In-Reply-To: <3152670.1725896400@sss.pgh.pa.us> 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 Στις 9/9/24 18:40, ο/η Tom Lane έγραψε: > Adrian Klaver writes: >> On 9/9/24 03:24, Achilleas Mantzios - cloud wrote: >>> And the thing is that this creation via DDL is inside our design. >>> Certain users create some backup tables of the public data in their own >>> schema (via our app), then do some manipulations on the public data, >>> then restore to the public or merge with the backups. When done, those >>> backup tables are dropped. So the DDL is inside the app. And the >>> question was if dblink is my only option, in the sense of doing this in >>> a somewhat elegant manner. (and not resort to scripts, etc) >> My sense is yes, if you want to encapsulate all of this within the >> database/app you will need to use dblink. > postgres_fdw certainly can't do it, nor any other FDW -- the FDW APIs > simply don't cover issuance of DDL. If you don't like dblink, you > could consider writing code within plperlu or plpythonu or another > "untrusted" PL, making use of whatever Postgres client library exists > within that PL's ecosystem to connect to the remote server. It's also > possible that there's some third-party extension that overlaps > dblink's functionality. dblink sure seems like the path of least > resistance, though. Thank you Tom and Adrian. > > regards, tom lane -- Achilleas Mantzios IT DEV - HEAD IT DEPT Dynacom Tankers Mgmt (as agents only)