Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfQPK-0003xJ-Gb for pgsql-admin@arkaria.postgresql.org; Thu, 23 Mar 2023 19:15:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pfQPI-0001mW-Rk for pgsql-admin@arkaria.postgresql.org; Thu, 23 Mar 2023 19:15:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfQPI-0001mM-Gf for pgsql-admin@lists.postgresql.org; Thu, 23 Mar 2023 19:15:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfQPC-0002OZ-4P for pgsql-admin@lists.postgresql.org; Thu, 23 Mar 2023 19:15:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 32NJFJsA1951204; Thu, 23 Mar 2023 15:15:19 -0400 From: Tom Lane To: Laurenz Albe cc: Sbob , Pgsql-admin Subject: Re: PL/pgSQL function to run DDL on a remote server/cluster? In-reply-to: References: Comments: In-reply-to Laurenz Albe message dated "Thu, 23 Mar 2023 19:52:02 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1951202.1679598919.1@sss.pgh.pa.us> Date: Thu, 23 Mar 2023 15:15:19 -0400 Message-ID: <1951203.1679598919@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe writes: > On Thu, 2023-03-23 at 12:03 -0600, Sbob wrote: >> Is it possible to execute DDL on a remote server/cluster from a PL/pgSQL >> function? >> If so can someone point me to docs or an example? > You cannot do that with the built-in tools. > You'd have to write an extension that can do that. You do need an extension, but contrib/dblink should do fine. regards, tom lane