pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PL/pgSQL function to run DDL on a remote server/cluster?
5+ messages / 3 participants
[nested] [flat]

* PL/pgSQL function to run DDL on a remote server/cluster?
@ 2023-03-23 18:03 Sbob <sbob@quadratum-braccas.com>
  2023-03-23 18:52 ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 5+ messages in thread

From: Sbob @ 2023-03-23 18:03 UTC (permalink / raw)
  To: Pgsql-admin <pgsql-admin@lists.postgresql.org>

All;


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?


Thanks in advance







^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PL/pgSQL function to run DDL on a remote server/cluster?
  2023-03-23 18:03 PL/pgSQL function to run DDL on a remote server/cluster? Sbob <sbob@quadratum-braccas.com>
@ 2023-03-23 18:52 ` Laurenz Albe <laurenz.albe@cybertec.at>
  2023-03-23 19:15   ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Laurenz Albe @ 2023-03-23 18:52 UTC (permalink / raw)
  To: Sbob <sbob@quadratum-braccas.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>

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.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PL/pgSQL function to run DDL on a remote server/cluster?
  2023-03-23 18:03 PL/pgSQL function to run DDL on a remote server/cluster? Sbob <sbob@quadratum-braccas.com>
  2023-03-23 18:52 ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Laurenz Albe <laurenz.albe@cybertec.at>
@ 2023-03-23 19:15   ` Tom Lane <tgl@sss.pgh.pa.us>
  2023-03-23 20:16     ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2023-03-23 19:15 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: Sbob <sbob@quadratum-braccas.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>

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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PL/pgSQL function to run DDL on a remote server/cluster?
  2023-03-23 18:03 PL/pgSQL function to run DDL on a remote server/cluster? Sbob <sbob@quadratum-braccas.com>
  2023-03-23 18:52 ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Laurenz Albe <laurenz.albe@cybertec.at>
  2023-03-23 19:15   ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Tom Lane <tgl@sss.pgh.pa.us>
@ 2023-03-23 20:16     ` Laurenz Albe <laurenz.albe@cybertec.at>
  2023-03-23 20:27       ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Sbob <sbob@quadratum-braccas.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Laurenz Albe @ 2023-03-23 20:16 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sbob <sbob@quadratum-braccas.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>

On Thu, 2023-03-23 at 15:15 -0400, Tom Lane wrote:
> 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.

Ah, of course.  Silly of me.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: PL/pgSQL function to run DDL on a remote server/cluster?
  2023-03-23 18:03 PL/pgSQL function to run DDL on a remote server/cluster? Sbob <sbob@quadratum-braccas.com>
  2023-03-23 18:52 ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Laurenz Albe <laurenz.albe@cybertec.at>
  2023-03-23 19:15   ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Tom Lane <tgl@sss.pgh.pa.us>
  2023-03-23 20:16     ` Re: PL/pgSQL function to run DDL on a remote server/cluster? Laurenz Albe <laurenz.albe@cybertec.at>
@ 2023-03-23 20:27       ` Sbob <sbob@quadratum-braccas.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Sbob @ 2023-03-23 20:27 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>


On 3/23/23 14:16, Laurenz Albe wrote:
> On Thu, 2023-03-23 at 15:15 -0400, Tom Lane wrote:
>> 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.
> Ah, of course.  Silly of me.
>
> Yours,
> Laurenz Albe


Thanks Tom!








^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-03-23 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 18:03 PL/pgSQL function to run DDL on a remote server/cluster? Sbob <sbob@quadratum-braccas.com>
2023-03-23 18:52 ` Laurenz Albe <laurenz.albe@cybertec.at>
2023-03-23 19:15   ` Tom Lane <tgl@sss.pgh.pa.us>
2023-03-23 20:16     ` Laurenz Albe <laurenz.albe@cybertec.at>
2023-03-23 20:27       ` Sbob <sbob@quadratum-braccas.com>

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