pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Sbob <sbob@quadratum-braccas.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: PL/pgSQL function to run DDL on a remote server/cluster?
Date: Thu, 23 Mar 2023 15:15:19 -0400
Message-ID: <1951203.1679598919@sss.pgh.pa.us> (raw)
In-Reply-To: <ad07bcffd3ab3adc3a98dffa068e0e213d87e006.camel@cybertec.at>
References: <f793707b-78a6-8c8a-367a-09a4a2a787b6@quadratum-braccas.com>
	<ad07bcffd3ab3adc3a98dffa068e0e213d87e006.camel@cybertec.at>

Laurenz Albe <laurenz.albe@cybertec.at> 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





view thread (5+ messages)  latest in thread

Message-ID: <1951203.1679598919@sss.pgh.pa.us>
Permalink:  ../1951203.1679598919@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1951203.1679598919@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laurenz.albe@cybertec.at, sbob@quadratum-braccas.com, pgsql-admin@lists.postgresql.org
  Subject: Re: PL/pgSQL function to run DDL on a remote server/cluster?
  In-Reply-To: <1951203.1679598919@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox