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 1v7mHO-007fPA-05 for pgsql-general@arkaria.postgresql.org; Sun, 12 Oct 2025 02:57:50 +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 1v7mGL-0009Mi-Gy for pgsql-general@arkaria.postgresql.org; Sun, 12 Oct 2025 02:56:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v7mGL-0009Ma-4W for pgsql-general@lists.postgresql.org; Sun, 12 Oct 2025 02:56:46 +0000 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v7mGK-001I0B-0C for pgsql-general@postgresql.org; Sun, 12 Oct 2025 02:56:45 +0000 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-35c80c1dc3fso1218892fac.3 for ; Sat, 11 Oct 2025 19:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760237802; x=1760842602; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=n+4tMU/NJMwoJu6hD/e4YsXlknodJJaG4bWw34WahjA=; b=lyLF5xcJ2Ey2ZyvpFdK+q4Rm/xScHU2XT4YJO5JabZ7pG4e43IDRBcxc0q3AmdOcz3 sWY6utnbeArl3oo3lqMAL4Lh4LgIoYKsWWujD25Sab1TUS1beqlZx5f39npwEDSSOuNb 2EzQDOAteVXEYB2agu3MVDEl5eSPYrmCEqz96JQ+xaQEVO1nAx4cCGDlcs+wr0tUDsnh HPYJoV89H5Rvc0QqcZN5UwyKfNt/QbvEcS0+x8yRpybgYoqF+cpIx4NTqSD7CNn8xasG 4jpPgtrwbLz1vSlXGMrL9Nw9faHMu2jvsP59IDMekxHEe8fukyow3qNpxAkoHYDsRfvk l3Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760237802; x=1760842602; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n+4tMU/NJMwoJu6hD/e4YsXlknodJJaG4bWw34WahjA=; b=NqKcU1Eu083yVJ4LX9rMACdpPF/UihOlQPSPOvul1EVEEg7JDxoye8fSyW1dhLlK11 VZZRZucOM2uMxvEZfmjkR8+esHTRvszeZ3KUAcffaCSvOuFGv640Jk7V7tbOHw7IJnRT XWju/WoSCD4he5SEhDj1Vhtj1U4N1W0S+PmyckXnbe2Gc9depbxjcZrmZh9uCuHMzJcM 8V/T66ROchD+xI4pmygp3DFWjO11KKBGF0mzn3LXGhXWCeMZg/tkrHKB9+jloVu/EfpW jdYfCjqsqqyllitBqMEeuBpDy39SjNH1vzc5FHQcr8divyH+bcjWH5RGG/ADTcm5eOE6 l8KA== X-Gm-Message-State: AOJu0Ywn/x2b9dcmaOCXk8mo1QuxbVWhYmFgTslowP/MG8AtLgSy/B3Y FE9WOUCmZLsr3XH3JawkmjwBPZeYRFe8CXbAPD2s5URznpvlX5tgF0Fv6y/utZiASru6eYzO5Cu TclhxgtRIlieO9OR66H1Pa1v7ZQjyYocgkrFa X-Gm-Gg: ASbGncuf9vjbOGA84McwmYAckoKvos3xfsFOge7BT/ocwMef6EH0n4nWFO75MbXroIO eSpVTRFu5+pJeeA70lAHlrk+1KqOh2/P1rW9It7iyyc7wNrkIA2AahqKpgsVrDuU1sYiKANc8xj QhIvhcltg8eMGspCHeLFsuEBQlecvOK6Y1TZZsAYbWrBr55pPscQrMY9m1JG4MbgqNZd2LwQBYC 88iLhjUiVxm52NjIjyBvFmGeOs= X-Google-Smtp-Source: AGHT+IE6JL5o/65QICJ1G/GmazNuvakleGWrFqyg4KF5vxhGfq+xU5CTmTt6egVgysDKRdQ+bUN7rrq8cPEmSm61PNg= X-Received: by 2002:a05:6870:828f:b0:307:b1b1:aeb9 with SMTP id 586e51a60fabf-3c0fa07d6b7mr9268239fac.35.1760237802512; Sat, 11 Oct 2025 19:56:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Sat, 11 Oct 2025 22:56:31 -0400 X-Gm-Features: AS18NWA7YZKaZoFN-aN_utYcnQm_zZOPdJ3J30BbtppkY4X34Ggr1HM7IP2bLwg Message-ID: Subject: Re: Option on `postgres` CLI to shutdown when there are no more active connections? To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000f067760640ed4c6d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000f067760640ed4c6d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Oct 11, 2025 at 7:11=E2=80=AFPM Adrian Klaver wrote: > On 10/8/25 12:39, David Barsky wrote: > > Hiya folks, > > > > I'm a bit of a newcomer when it comes to PostgreSQL, so I apologize if > > this is > > the wrong mailing list. Anyways, my two questions: > > > > 1. Is there any interest in adding a command line option to the > > `postgres` CLI > > that shuts down the PostgreSQL instance once (and optionally cleans > > up the > > data directory) once all connections have disconnected? > > https://www.postgresql.org/docs/current/app-pg-ctl.html > > " > stop mode shuts down the server that is running in the specified data > directory. Three different shutdown methods can be selected with the -m > option. =E2=80=9CSmart=E2=80=9D mode disallows new connections, then wait= s for all > existing clients to disconnect. If the server is in hot standby, > recovery and streaming replication will be terminated once all clients > have disconnected. =E2=80=9CFast=E2=80=9D mode (the default) does not wai= t for clients > to disconnect. All active transactions are rolled back and clients are > forcibly disconnected, then the server is shut down. =E2=80=9CImmediate= =E2=80=9D mode > will abort all server processes immediately, without a clean shutdown. > This choice will lead to a crash-recovery cycle during the next server > start. > " > I think OP is looking for AUTO_CLOSE, like SQL Server (and Rdb/VMS before it). Its only real utility is OP's use-case: a Windows desktop running local testing. We in the shell scripting daemon world don't think like that. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000f067760640ed4c6d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Oct 11, 2025 at 7:11=E2=80=AFPM A= drian Klaver <adrian.klaver= @aklaver.com> wrote:
On 10/8/25 12:39, = David Barsky wrote:
> Hiya folks,
>
> I'm a bit of a newcomer when it comes to PostgreSQL, so I apologiz= e if
> this is
> the wrong mailing list. Anyways, my two questions:
>
> 1. Is there any interest in adding a command line option to the
> `postgres` CLI
>=C2=A0 =C2=A0 =C2=A0that shuts down the PostgreSQL instance once (and o= ptionally cleans
> up the
>=C2=A0 =C2=A0 =C2=A0data directory) once all connections have disconnec= ted?

https://www.postgresql.org/docs/current/app-p= g-ctl.html

"
stop mode shuts down the server that is running in the specified data
directory. Three different shutdown methods can be selected with the -m option. =E2=80=9CSmart=E2=80=9D mode disallows new connections, then waits = for all
existing clients to disconnect. If the server is in hot standby,
recovery and streaming replication will be terminated once all clients
have disconnected. =E2=80=9CFast=E2=80=9D mode (the default) does not wait = for clients
to disconnect. All active transactions are rolled back and clients are
forcibly disconnected, then the server is shut down. =E2=80=9CImmediate=E2= =80=9D mode
will abort all server processes immediately, without a clean shutdown.
This choice will lead to a crash-recovery cycle during the next server
start.
"

I think OP is looking for AUTO_C= LOSE, like SQL Server (and Rdb/VMS before it).=C2=A0 Its only real utility = is OP's use-case: a Windows desktop=C2=A0running local testing.

We in the shell scripting daemon world don't think li= ke that.

-= -
De= ath to <Redacted>, and butter sauce.
Don't boil me, I'm s= till alive.
<Redacted> lobster!
<= /div>
--000000000000f067760640ed4c6d--