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 1tddJV-008bOA-RL for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 22:47:10 +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 1tddJT-00DsPO-8f for pgsql-general@arkaria.postgresql.org; Thu, 30 Jan 2025 22:47: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 1tddJS-00DsPF-Uh for pgsql-general@lists.postgresql.org; Thu, 30 Jan 2025 22:47:06 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tddJQ-002Pon-1E for pgsql-general@postgresql.org; Thu, 30 Jan 2025 22:47:06 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5fc0b7a4e5dso653678eaf.1 for ; Thu, 30 Jan 2025 14:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738277222; x=1738882022; 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=roBNrAjIfaeqmQm6RwexIWI/JnrN02DJwEp78zQnVO8=; b=HSCMep7+TbzCLJqdtQUiVWN0wj6YrZ9xA4R7gFvqoUwC87hQ5sFItXgYgWZRROVR9+ rx8qXx99W0w/Ltx4JMela1JgcHs5QjdFy3Gs40ZhxXn+8Z1v/8uPBHEBxUBhtc+WXgQ0 YAgPiZlZTXN5qf7tY9vNeaVfAUQ4fwuw1AguoLxBEAL2WXkG9kZwlrNzMli9ZA+mUlXh dhrKHC4N+YZsYVjdheeE/dishb2sxvQyllRudFRtIiH7k5jlgO4xoill6wsCn/tNJhcW VFX6KM6ucUNHji0PnmX15XN/bIs6V3dNPIfyPvIc7a6jiXUzRh2q76gfKYpqX9ZDYfO9 n4gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738277222; x=1738882022; 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=roBNrAjIfaeqmQm6RwexIWI/JnrN02DJwEp78zQnVO8=; b=nqK3AVaLqqRPrXTiv1tSf4Epys8D89KehwCYLgbhMKwguph4C8DB5yz9xhu7/4Ttfz 7a76aI645WDQFVuY9jdxhbD6RwpTKu1dJQPhS+2swQ0YqENKG4iRFoLDkX/yOrGmzmrp NiWbE1fY8eBZUKq727Up6+Li13nvTC+zWHnvLbuxoFvGwxVks7j/9VhxyS58UfZaMwLX dqo3CMdL4hc++tagQlYZ6H0WW2muyfLlKwu59C7Htt5sqvqISfgSMwQ6qDLFAbdHT+ju /a4HskhOVRnYwAHjeK3lUeKfefk0F2Fe+Jk9iCNCvxvBB+pgAXBPez7gBfCzrwuLfjSY ++aA== X-Gm-Message-State: AOJu0YymZWTfyNsskTqpbN1e0Gqmv4xuSJuU4Cmt3SCeuHAY6iNJKIHP DtlQoPTCy8iQ4aG5NNhoHbx+X+JC9CTAOUd0Ftfi2yRvZbFh0HNViSUmGcv/ZnlCTUM2/XV1xfu 4jvkQqsuGSxvVLVdX/5upNFyk0H9XxJUI X-Gm-Gg: ASbGnctdqW7x1D5erxl37We5pQKHCmXOuQioWub34z9lrDZZ1FJOojpTW4Wk2nus8Me ylkPcEgO2fj3w7L4UpEqdmoBbdcERGRT8i79bqDGFSCmx4FS9ahig33eudFPf8AUJV+EfMFU= X-Google-Smtp-Source: AGHT+IHvZi+yvJBhhS0JiKAf/3clzi7HtsNS+nYBWFi93oDuY4DfNAEbs/g3+msDMFbp9k5Ufm0sc697t8F+N9cPsfw= X-Received: by 2002:a05:6871:2085:b0:296:bbc8:4a82 with SMTP id 586e51a60fabf-2b32f28615amr6141271fac.27.1738277222631; Thu, 30 Jan 2025 14:47:02 -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:46:26 -0700 X-Gm-Features: AWEUYZnOQnXe7ForpVGXZOz6ANb6fkLaXtozcxKMG7XdDUuXaIPDs0Ej9wI5dQY Message-ID: Subject: Re: Using psql's \prompt command To: Rich Shepard Cc: "pgsql-general@postgresql.org" Content-Type: multipart/alternative; boundary="000000000000604ebb062cf4348e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000604ebb062cf4348e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 inp= ut >> string into the script. >> > > That is what \prompt is for. You have the correct meta-command, you were > capturing user input just fine. Read about how to use variables in queri= es > for the part you are missing. > Specifically the section of the psql docs titled: SQL Interpolation David J. --000000000000604ebb062cf4348e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jan 30, 2025 at 3:44=E2=80=AFPM David G. Johnston = <david.g.johnston@gmail.co= m> wrote:
On Thu, Jan 30, 2025 at= 3:38=E2=80=AFPM Rich Shepard <rshepard@appl-ecosys.com> 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<= 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 doc= s titled:

SQL Interpolation

David= J.

--000000000000604ebb062cf4348e--