* Dennis (denn...@visi.com) wrote:
> Is it possible to execute command in on system the is hosting postgresql 
> remotely using psql or other mechanism?  I know I can use \! in psql but that 
> executes the commands on the host where I am running psql from.  Also, is it 
> possible for a postgres login/user to stop or restart a running postgres 
> instance from in side psql or similar client. e.g. psql -c “pg_ctl stop -D 
> some_data_dir”

You can use COPY with PROGRAM, assuming you're a superuser.

COPY (select 1) TO PROGRAM 'whatever command';

You could use that to issue a pg_ctl stop, though you'll then lose your
connection to the database.

You can 'reload' the running configuration by using:

select pg_reload_conf();

Not all parameters can be changed while PG is running, but most of them
can be.  Parameters in postgresql.conf can be updated via ALTER SYSTEM
through psql also.

Issuing a 'pg_ctl restart' via COPY PROGRAM isn't a good idea and may
not work, though I suppose you could try if you really wish to.

Thanks!

Stephen

Attachment: signature.asc
Description: Digital signature

Reply via email to