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 1tpGau-002li4-Oy for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Mar 2025 00:57:12 +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 1tpGat-002kZx-EC for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Mar 2025 00:57:11 +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 1tpGat-002kZo-2p for pgsql-hackers@lists.postgresql.org; Tue, 04 Mar 2025 00:57:11 +0000 Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tpGap-000o7f-1k for pgsql-hackers@postgresql.org; Tue, 04 Mar 2025 00:57:10 +0000 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 4D6431140476; Mon, 3 Mar 2025 19:57:07 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 03 Mar 2025 19:57:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1741049827; x=1741136227; bh=CWW/vjHWQe H5nbzFEMlWMW2MaUWjelLIJcf9e3HVRlo=; b=HU9/XJyefuwp9qrAF9UnwB9mlb CydXiPIC5cqzabiY445ZYuBKiSRBoAQk6sKQFivpEBtyoHnCsEG7Oz2oY0931RAC 6V1AEtQeMUESJeZYzynkAdpsIXp7svG0cJDR5rrXzg8yc4PviuGYk3+9dT2IVfvR rYjEb3FHgnU/X7VP5O+4gQ/05utxsgN25sR/D3vgDN9BICn4JVie/yOOZmeR/EaM V7AhKGN/yexi0uaUNhlh6q5XiFTmyCHCBFT7ObiQhUX/oQo3Dzt452WoAb9NUzI/ 9iTGl/Y9QvKfOCvJkv8I+1JZtTIwoSF8V9FcflDKqXCZVoGlnfxm8hDfjVgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1741049827; x=1741136227; bh=CWW/vjHWQeH5nbzFEMlWMW2MaUWjelLIJcf 9e3HVRlo=; b=vbmtmnG6A9V2KGpZAgViBSDBIaUyWDev1zhKTciv8ZOgdDa/jJR wvEwx43p3kLK/Rce4BYvHCJjFUPlVVCxKA94NPk2JgrBpuGgmsXoNqhmgsfw/YTb NR8hx4lzdAWIUEmLcInTGFNCMPpFBNjNQWrDb5j8Nxt/sLTChNI7dbYKYyg649Id kSbQpg0ChYvqH0XZJDU6ZY6LaTnYaQjRNPlmUpeODMNd96VUpSTEE1tmYCt0fV0i 4FQ2VblnaLKIJ9Ev/V2HtGTORhbwQnay+bs3Rkmo4qNSLy71Utc4zwvCxLyWsGhU ckjWyyQa8YcjkGM9hUj4qu9gU4CL0jv1tXA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutddtieduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefu kfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivg hruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhep teelieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggv lhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtph houhhtpdhrtghpthhtohepuggrnhhivghlsehmrghnihhtohhuqdhmrghilhdrohhrghdp rhgtphhtthhopegrnhhthhhonhhinhdrsghonhhnvghfohihsegurghtrgguohhghhhqrd gtohhmpdhrtghpthhtohepphhoshhtghhrvghssehjvghlthgvfhdrnhhlpdhrtghpthht ohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Mar 2025 19:57:04 -0500 (EST) Date: Tue, 4 Mar 2025 09:56:55 +0900 From: Michael Paquier To: Daniel Verite Cc: Anthonin Bonnefoy , Jelte Fennema-Nio , PostgreSQL Hackers Subject: Re: Add Pipelining support in psql Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="O8MxNDXE8PBhxi6m" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --O8MxNDXE8PBhxi6m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (My previous message did not reach the lists, so re-sending with some edits.) On Fri, Feb 28, 2025 at 05:31:00PM +0100, Daniel Verite wrote: > The following invocations don't respect the desired output destination > and formats (ignoring them), when a pipeline is active: >=20 > select ... \bind \g filename > select ... \bind \g |program > select ... \bind \g (format=3Dunaligned tuples_only=3Don) >=20 > Just like for \gx the problem is that in a pipeline, sending the query > is not followed by getting the results, and the output properties > of a query are lost in between. Right. I completely forgot that these options could be applied with a simple \g. With the results being decoupled from the execution, one can argue that the options defined at the moment when the query is sent and executed should be the moment commanding how the result are shaped when retrieving a batch with \getresult during a pipeline. However, this means that we would need to save the set of options from printQueryOpt when running the query depending on the number of results we expect, and reapply them in order of the results expected. We have the APIs to do that, with savePsetInfo() and restorePsetInfo(). Anyway, can we really say that the set of printQueryOpt saved at execution is the correct set to use? It is possible to have the opposite argument and say that we should just apply the printQueryOpt at the moment where \getresult is run. A benefit of that it to keep the loop retrieving results simpler in ExecQueryAndProcessResults(), because we pass down to this call *one* printQueryOpt as "opt".=20 There's of course the simplicity argument that I do like a lot here, but applying the printing options at the time of \getresult feels also more natural to me. FWIW, I agree that HEAD is unbalanced with its handling of \gx, so we could do one of the following two things: 1) Ignore any formatting options given to \g, but also allow \gx to run, documenting that during a pipeline the formatting options are ignored, and that the set of options defined when doing a \getresult is the only thing that matters. 2) Invent a new meta-command (suggested by Daniel Verite off-list, and not published to the lists because I don't know how to do a reply-all), like a \send, a \push, forbiding entirely \gx and \g when in a pipeline. If we were to integrate options into this new meta-command, a split with \g would make an integration easier to think about. One name suggestion I can come up is \sendpipeline. I'd consider option 2, based on Daniel's concerns. One line I'm going to draw here is that we should not go down to manipulations of printQueryOpt while retrieving batch of results depending on the style of output that was defined when sending a query in a pipeline. Anthonin, as the primary author, any thoughts? -- Michael --O8MxNDXE8PBhxi6m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmfGT9YACgkQnvQgOdby QH0kYBAAhUGT/FykqU2xPqR4fQ0EYfUPReBqB3GeIAiJV3gRi85P8ufi2LS8l1tc HnBj9bfLtxN73Wz2zpwvrne7tZ1zeoD/QAnmnhFEWzPbPKjZGppq+ksHcV+a/mql 6dmIh2X7ZemJPwVoBjEOiqyBdv9XooT2KWOosFJdinf3B/V2VeNH102T2urSUmRe rdcCHkyfiPDczCu0Ir3+Vh/idCqOSn+Ix3Id0Oex13fVCau7HZMVcn9GgT1ildbH aAXjKuZnua+VdrWKOBfyuWQVm1CqGiRWhR2aBONtvnWhOY//yBCnKaAT7Qh4jR0x vwNt3Yk00tdQnjqgCnNhzVfGQYvyR6KM5CJUXCD0pRuAXefj2J8AJ7SYh7RYmQMx htekRM0PlgKS8edLEwa1s/vx2VimcLWC69tmIH1PKewf7Elti5HkV20Byk1jhmdm Pp19uSokZ4ri0q/8wYmwcwqeZeYqdcBLhv4MjmNSiNB+sKNpzagu7Xn0+XA+OgS8 RsL+lmseYV94i1bJk1hwqYVtuHtArwBGGBEQ1crGEOXVy6gNIJN1EdpQVGwC4Gau 8qty6d2+ZW935BcivcIfcAQ+A4TgcKkem+a4SB4oy83mKcKml4taH3edDI1gpdqO +3gIOGzx/l5qPD7N6vxx1VEui79x05/IK9pMJJK7okSpR7LL0mg= =A19p -----END PGP SIGNATURE----- --O8MxNDXE8PBhxi6m--