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 1tqSlY-005LRf-Kc for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Mar 2025 08:09:08 +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 1tqSlX-00BBtu-9X for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Mar 2025 08:09:07 +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 1tqSlW-00BBtl-UX for pgsql-hackers@lists.postgresql.org; Fri, 07 Mar 2025 08:09:06 +0000 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tqSlT-001SlS-0k for pgsql-hackers@postgresql.org; Fri, 07 Mar 2025 08:09:06 +0000 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-6febbd3b75cso9867507b3.0 for ; Fri, 07 Mar 2025 00:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1741334943; x=1741939743; darn=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=a/2kmOY0OKGjKfo5v0OsR9Oqawr5Ne9D2h+l5eJuy7s=; b=R1Jql/DLvDyzvpBUSCFJYl2Bo9M50EFGtak2N4p5HSg4oMLeAy5ZnEsvWsTmf6ueFE RwizvHx6cOXSWvIjxG2RRR/vzz9ZQmwK6oXXMzqFAxm6Qzlj5RONJNQrtPu6h26NrC3F kRhQHNlegc1caL/adMwpeHzgo/WATZ7P0YSFk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741334943; x=1741939743; 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=a/2kmOY0OKGjKfo5v0OsR9Oqawr5Ne9D2h+l5eJuy7s=; b=hsiBs5JXpUlf6IUxSY6zFLqV6dQaYHRaSmabOWcEiFoEddpTyD8holI2O8qLBz6x8G FPiw0S9USgi+GgnvoaRNL6gUZll/Ogfei+IiFzGzVWsoCqG3wnWfCZunDxpcoTriVIHP u2AJBdDKa3QftZIPGC485usCTvXKztAPuYeTOvmv1mA34VVNrT+LpUr6GX6CaHh4leU7 3RXmP1bm7X+oNFGkP1HXSi/TXKjR26E4JzBmMOgz7vAh0C8KHtIKq9obQ6mWUUB4kQTS ZVVnQWlQsUNfX82h7PfqPeK4elXjq0NTI7ref++1Gt27m2Y780IArqizKiWQ/u5ryZQY NARg== X-Forwarded-Encrypted: i=1; AJvYcCXWSbFBpUI4Tl3Qg8qzVp44P9pI7pbKre2FhuFJxd04/WYz98BXRWjSryASJQdk0FUs5dUvCXea9LodIe0s@postgresql.org X-Gm-Message-State: AOJu0YzGB1paoaH+038xe8n5QDknODfI4Mke1bG7LUifs1u6c3HCNX1V cCZ/Luvrg5BV53QccCGJdDNxtP39XaABK5UHV9tLcnr1WTOSem+ORZPjg+SSbEICgVCLrNrWqg9 5xVqH/N1qqnrjlsaYLmYv1FwKfzIDK1ctGb7mvXqH26XezNzgu7txeA== X-Gm-Gg: ASbGncuP74fU9lQPibgEvNX5fpimHliq4R7w06desZY+WhlMBXb8eaHFFgGDwKp/R1S Q+9gImE97vDCGke4Re66x7hrGCqJ7D68O1GYfVJdoxhY0AzXJtewcNzk0z8Ux1tdvMKrOcjML6V sHFBFHHDZTTUvqE2u9B8BznqP0zA== X-Google-Smtp-Source: AGHT+IEJLzw5tX7LerGbY8ZQRyOef78j7iKhRT9d4zY2LV1JgH4PliN1g+trHSzPvOp8gIsWzQE/fd+ZtU53KJrBFT0= X-Received: by 2002:a05:690c:6f12:b0:6f6:d01c:af1f with SMTP id 00721157ae682-6febf2f7323mr39057277b3.16.1741334942452; Fri, 07 Mar 2025 00:09:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Anthonin Bonnefoy Date: Fri, 7 Mar 2025 09:08:51 +0100 X-Gm-Features: AQ5f1Jor8vVyOBZEXlZ_yqXpYkOq5FQu39wY_y-rR_JagH2A38g500yPfQqRubk Message-ID: Subject: Re: Add Pipelining support in psql To: Jelte Fennema-Nio Cc: Michael Paquier , PostgreSQL Hackers 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 Thu, Mar 6, 2025 at 5:20=E2=80=AFAM Michael Paquier wrote: > That was not a test case we had in mind originally here, but if it is > possible to keep the implementation simple while supporting your > demand, well, let's do it. If it's not that straight-forward, let's > use the new meta-command, forbidding \g and \gx based on your > arguments from upthread. I think the new meta-command is a separate issue from allowing ';' to push in a pipeline. Any time there's a change or an additional format option added to \g, it will need to be forbidden for pipelining. The \sendpipeline meta-command will help keep those exceptions low since the whole \g will be forbidden. Another possible option would be to allow both \g and \gx, but send a warning like "printing options within a pipeline will be ignored" if those options are used, similar to "SET LOCAL" warning when done outside of a transaction block. That would have the benefit of making existing scripts using \g and \gx compatible. For using ';' to push commands in a pipeline, I think it should be fairly straightforward. I can try to work on that next week (I'm currently chasing a weird memory context bug that I need to finish first). On Fri, Mar 7, 2025 at 1:05=E2=80=AFAM Jelte Fennema-Nio wrote: > One thing I've noticed is that \startpipeline throws warnings when > copy pasting multiple lines. It seems to still execute everything as > expected though. As an example you can copy paste this tiny script: > > \startpipeline > select pg_sleep(5) \bind \g > \endpipeline > > And then it will show these "extra argument ... ignored" warnings > > \startpipeline: extra argument "select" ignored > \startpipeline: extra argument "pg_sleep(5)" ignored It looks like an issue with libreadline. At least, I've been able to reproduce the warnings and 'readline(prompt);' returns everything as a single line, with the \n inside the string. This explains why what is after \startpipeline is processed as arguments. This can also be done with: select 1 \bind \g select 2 \bind \g And somehow, I couldn't reproduce the issue anymore once I've compiled and installed libreadline with debug symbols.