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 1tddKj-008bUI-HJ for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 22:48:26 +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 1tddKi-00DvS4-GT for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 22:48:24 +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 1tddKi-00DvRw-6Y for pgsql-general@lists.postgresql.org; Thu, 30 Jan 2025 22:48:24 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tddKg-002Mjt-0K for pgsql-general@postgresql.org; Thu, 30 Jan 2025 22:48:23 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-71e15d9629bso400915a34.1 for ; Thu, 30 Jan 2025 14:48:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738277302; x=1738882102; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UnZy3uBaaZaMt4KG69CINRTPRmzqIHy7V/RubuUZx+w=; b=fJKdVE2YsQ+pqlv5oKfBadOF728VVhgcVtRGREUP5yPNItzXLhfAl+ajcx0gT8c+oC NOcQY2Ep/5z3J/+24nxdHmhfgLB8VTg8IORPwkA4OCvGlbpkDAjSyA0lENaTiVay0yUW f69vyLl1nLVUTbHAWv4Wq/TiDRV+YGU3mzzOu0cWiEzU6HwKSOaJDClQt7zYKW51zRVA WIDHeXOGEOfgsGkuSThv/eyT1GVuRwEgJQKJMk2Ha7kQbw9n15KcETqjI2JqHQnYKdjZ ayoKoBENvsaREaKujOLXW6kfwF4HepqnY7dPog0TkAM425tWoOKpdMiUDjZ5wApmhl3M tnqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738277302; x=1738882102; h=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=UnZy3uBaaZaMt4KG69CINRTPRmzqIHy7V/RubuUZx+w=; b=KxNSlWaPfEGp2qt6Ni1OdZ1IGsrduvxOQBwuiIVTSM2StZTaMd57r+8QX33qI/SwFw 2LHoREv/ldlfqPn3WIb8bVrdb8rZEG4D7Lt5Mq5j2KQ8+UEaK8s5Zq26oqAlThe+k6Pv QRKbBXvdabtaAw8kLcegiJ5g+mOQNzLTvCAMM9NB9ZZ1FPO/7jDNep7VA3kMVz+/DyuS hEaaSSdlBpSoir7S7x3O4mwatAzzUvoZpykDqoke4ixXvPfphtxJt56EpnC5lZdRnMUl 2ykt/g4rQLIBZhlvhrtSL2ViggRBtVMU+dKWNTUNTwrvXA0OJs8Hmj4BQ+a1v99fIGDA dS8g== X-Gm-Message-State: AOJu0YwehHKbqJoJHf+zvXLi7cW19nPBagRWl2QC1vXYS3NSF0SdbLre SdwThnOvzxkXHCmXfbw9mm4EaVq2FJifKRgMFiLZeCPQ62TYQmkZJ628+TQMke8kU3GUusYSQQ5 ox89aZ3wDI+4EJXEM44UE/EScMbBLkAsN X-Gm-Gg: ASbGncuR6PQ675XQTgu4CfRgj/GwDMlESRTKyp1r5BvuUZWs9G2xq46WPJRxNJtzbB0 ejtStFMQVJFvbDX/9r/RvyKGkcQ0kMjOC1OwSNmvlQwusEdR3hDj8dptv/KnwrnlkyxErKNo= X-Google-Smtp-Source: AGHT+IHaJxnX2YUsxuEF50EuRHEOh4ryadkSk3xa/s24MjvP/F9pTKsmhjhUsDVxDzK7NZfKHHqA6NvT8qDDmZiEQRI= X-Received: by 2002:a05:6871:2011:b0:29e:503a:7ea3 with SMTP id 586e51a60fabf-2b32f2f0137mr5670075fac.36.1738277301974; Thu, 30 Jan 2025 14:48:21 -0800 (PST) MIME-Version: 1.0 References: <1dbc1ace-c119-6ed2-d579-561525f3bf0@appl-ecosys.com> <28334f3d-5942-4849-374f-32f2f6a4e9c@appl-ecosys.com> <69ead979-7c20-d246-b52f-3e7af585da3d@appl-ecosys.com> In-Reply-To: From: "David G. Johnston" Date: Thu, 30 Jan 2025 15:47:45 -0700 X-Gm-Features: AWEUYZnmoVlxlpDJsGD_8kMHJ1PO16h1m94znKgQD6cYAiQl4U5dsBOiPjdgpMs Message-ID: Subject: Re: Using psql's \prompt command To: Rich Shepard Cc: "pgsql-general@postgresql.org" Content-Type: multipart/alternative; boundary="0000000000001afdb1062cf4398a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001afdb1062cf4398a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 30, 2025 at 3:46=E2=80=AFPM David G. Johnston < david.g.johnston@gmail.com> wrote: > On Thu, Jan 30, 2025 at 3:44=E2=80=AFPM David G. Johnston < > david.g.johnston@gmail.com> wrote: > >> On Thu, Jan 30, 2025 at 3:38=E2=80=AFPM Rich Shepard >> wrote: >> >>> On Thu, 30 Jan 2025, Rich Shepard wrote: >>> >>> > Thank you. I'll look into using the \set command. >>> >>> My web searches find many examples of using the \set command, but none >>> getting user input with \prompt. >>> >>> Please point me to a reference where I can learn how to get the user >>> input >>> string into the script. >>> >> >> That is what \prompt is for. You have the correct meta-command, you wer= e >> capturing user input just fine. Read about how to use variables in quer= ies >> for the part you are missing. >> > > Specifically the section of the psql docs titled: > > SQL Interpolation > > Or: Advanced Features - Variables David J. --0000000000001afdb1062cf4398a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jan 30, 2025 at 3:46=E2=80=AFPM David G. Johnston = <david.g.johnston@gmail.co= m> wrote:
On Thu, Jan 30, 2025 at= 3:44=E2=80=AFPM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Jan 30, 2025 at 3:38=E2=80=AFPM Rich Shepard <rshepard@appl-ecosys.co= m> wrote:
On Thu, 30 Jan 2025, Rich Shepard wrot= e:

> Thank you. I'll look into using the \set command.

My web searches find many examples of using the \set command, but none
getting user input with \prompt.

Please point me to a reference where I can learn how to get the user input<= br> string into the script.

That is what \prompt is for.=C2=A0 You have=C2=A0the correct meta-co= mmand, you were capturing user input just fine.=C2=A0 Read about how=C2=A0t= o use variables in queries for the part you are missing.
<= /blockquote>

Specifically the=C2=A0section of the psql docs titled:

SQL Interpolation


Or:

Advanced Features
- Variables

David J.

--0000000000001afdb1062cf4398a--