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 1v8EDU-00Em8a-6P for pgsql-general@arkaria.postgresql.org; Mon, 13 Oct 2025 08:47:40 +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 1v8EDR-0051MD-UR for pgsql-general@arkaria.postgresql.org; Mon, 13 Oct 2025 08:47:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v8EDR-0051M4-JL for pgsql-general@lists.postgresql.org; Mon, 13 Oct 2025 08:47:38 +0000 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v8EDQ-001tjp-1G for pgsql-general@lists.postgresql.org; Mon, 13 Oct 2025 08:47:38 +0000 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-30cce892b7dso1886450fac.1 for ; Mon, 13 Oct 2025 01:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760345254; x=1760950054; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xR8cLV2A/1xJq5EbGAe5AaGGHuXsxrfoq+r3xMOY7lo=; b=jDuFJ8R/H/keQ0n/nNJ8gGhKEPZsNW7J0AmbotCwJAz6eETG2wT5lMXLxMKpRIHStk IgaS8wdEufCztoi5mg+eSGdycs8ruxrltUStYfv3HBrZ3E4wWcb65lEc9zF1DUs5SVoU 7Fk/KWRx3FiPy2dVWWA7kEcljrf0Qzam9vj+df8qBUshBISHHzIJ6WNCBsvgh8h5cBnv Tweo2Ivu7PevazIAHUeZpdtR58Yep2y7MSHmFDtem6aqKHycWJ2LBG5UuGbOazT2438A e8WsA88bohbiDsZ6LGIpYct14nW7QvPeHFs7Wr8K7SFvyzMNZk2dwmz8cFCsQwmZyr82 pd3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760345254; x=1760950054; h=content-transfer-encoding:cc: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=xR8cLV2A/1xJq5EbGAe5AaGGHuXsxrfoq+r3xMOY7lo=; b=owFpCkogfHikFBkG+5LyRBEavoyT48ZZJzVStMJrJYrl6Lo5iE2SqJNJGOGPUdJLDH 9gyci8YlguWuisp0tw7oYJ2Zwwb8ai4l915njpcc4bHMezTKPOVKbq4lfQONyaOFPhxC 7anTeRA8+Su9tYD3W8LG0veZply20mvwUGqSXyZnpmEHWAAbprjPxWqV2+TvwjnDNYKN LbhU1c/Nb3x65w/YQhIamh2hq/qCavaWDWAE9M3YkZ6E8OGOw2L7MndUEY1Lz+cX6We2 2LAi+mhrM7K3ITj7Pt9oKjoNeZI+xuFaBv3ytt0uGKb0QWY4Eqn7rncxj2WQkGVB9JoO q+rw== X-Forwarded-Encrypted: i=1; AJvYcCX+alnzRS+BHcpO5LhqhkCooevR3/jbezX/hzZ+IKiSneojzgCVeuhdt++Fgc4LYwgZub6Z+jBbulESQWDO@lists.postgresql.org X-Gm-Message-State: AOJu0Yz8A5UdPGq/Wtdi49vMFPjaaN70ivQHx2q98KU95FbxeOnXpxwa DkhgG0jrchRX/3VIBrC2OdzpezT10rFh+kpeBQwSf13O/20VpkLJ1BLNiSjdE4tlhwdt0hsELTH wKs3b/oQU1K8hDLBP4rVpOCz1ponjFME= X-Gm-Gg: ASbGncuWN1QwnlFhwEYl09+VPV32WgvbNtcwTKyirT+K63zg6sFh79XATf+PR1JjICa xs0Yn2MGhf9iaGkv1ckYI51bLLdyJcspbRSWA41dD+IHrisvNUWuhdclC01k4da6QvLi6XcJA/Q oiAcSGrstyYyHxMyWzZ+tPjr64nyT8GSOQtGWW1iGwiKbNj832AsjOv/TnZOCLF8oI3YMWa9/gP 2tU5NSkDgWjqTlUeHCKchPwJKiiQHUpPZDmnQU= X-Google-Smtp-Source: AGHT+IGGlOPtpaghmbTxESbp479zTX+lWvmtjrlMsmbwhYe8gZgjpWlyWPdPKKwbQmKPWAbRmqehemdPbz/ALtAXQIw= X-Received: by 2002:a05:6870:8185:b0:308:51fe:ea07 with SMTP id 586e51a60fabf-3c0f590e8afmr9053108fac.1.1760345253887; Mon, 13 Oct 2025 01:47:33 -0700 (PDT) MIME-Version: 1.0 References: <73ff46d2-0bad-4a8d-9928-e494c2d5b0d1@gmail.com> <93702.1760321769@sss.pgh.pa.us> In-Reply-To: <93702.1760321769@sss.pgh.pa.us> From: Dominique Devienne Date: Mon, 13 Oct 2025 10:47:22 +0200 X-Gm-Features: AS18NWBuQz6J5o47Xu9vtvK4YWOmc3zf8sBvSUYhPiv4eWiE7eMEq67t_gp55Wc Message-ID: Subject: Re: Option on `postgres` CLI to shutdown when there are no more active connections? To: Tom Lane Cc: Rob Sargent , pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Oct 13, 2025 at 4:16=E2=80=AFAM Tom Lane wrote: > Rob Sargent writes: > > On 10/12/25 16:10, David Barsky wrote: > >>> Postgres is not an embedded database, if you want that experience the= n > >>> use a database that is designed to be embedded. > >>> That's fair, especially from an operational standpoint. However, I _thi= nk_ >>> Postgres can get really close to an embedded database's development >>> experience by doing a few tricks that I'll elaborate on later on in thi= s email. > >> Were I a betting man, I would bet heavily against this community, which >> prides itself on NOT losing data, allowing an option that would do just = that. > > But I concur with the point that we're not here to pretend to be an > embedded database, as there are other projects that do that better > (for example, our good friends at SQLite). Heavy user of SQLite here, and I have to disagree Tom. The main reason PostgreSQL can't be embedded is because of its process-based model with globals. And perhaps locking as well. But otherwise it would a dream-come-true for single-user mode of our app, and for testing as well, I have to agree with David. Even a localhost-only mode that still functions as a normal cluster except auth is entirely OS-based and it uses a random port (or bypasses TCP entirely in a *CROSS*-platform way), based on which pgdata-directory is used, would be OK. There's apparently no way to abstract the "transport" between libpq and the server, must be TCP (or *nix only socket files), cannot be an in-memory channel (for the embedded non-shared case), nor shared-memory (for the shared-case across localhost processes). SQLite is fantastic, but it's type-system and lock-model are too restrictiv= e, for a general DB. Similar to David, I think PostgreSQL is close to my ideal above, yet still far-enough (and perhaps unwilling enough, as a community) to venture into embedded and localhost use-cases, that it's frustrating. My $0.02. --DD