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 1sPXZd-0057J6-9W for pgsql-general@arkaria.postgresql.org; Fri, 05 Jul 2024 01:17:17 +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 1sPXZb-004hki-9z for pgsql-general@arkaria.postgresql.org; Fri, 05 Jul 2024 01:17:15 +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 1sPXZa-004hkZ-Vm for pgsql-general@lists.postgresql.org; Fri, 05 Jul 2024 01:17:15 +0000 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sPXZZ-000TUO-O4 for pgsql-general@lists.postgresql.org; Fri, 05 Jul 2024 01:17:15 +0000 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-5c1d2f7ab69so537189eaf.3 for ; Thu, 04 Jul 2024 18:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720142231; x=1720747031; darn=lists.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=G+Fqf9eCe07CuHKRJaFaauKteKtoH5H+stI8/CBtdIY=; b=YD68VGq6pV47S2FrH9Y+BkHD2pb4875awEQFSJdGjSi+bjGPiLmis52i/tI5548bY2 2aChCmGyyXzfAFlZaO5XsmvRTqEsIwnutMmt4IJcs3yWKq7c13TUDnLmMahaWUCyTvMF XB9mGv6gt3bggYntUPjiaUak0/lWLhbvSVejDGyoPMxKQ9OOMfQbocJF+F4+4MyOlK6t GO+ezu4CDHa9bnayvbX8wxQCSofQQL0YSSwzeByiqIS0QV0ZZFrdrnPwn/kmUx6l8RJu UEqDBVye1pUWkFgFOZw7CXS0doyGcPgC+4Vd/FYb2LJuUZ/mHbW7vsHbtPbD/Q/d+9yM EBVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720142231; x=1720747031; 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=G+Fqf9eCe07CuHKRJaFaauKteKtoH5H+stI8/CBtdIY=; b=jTTMgn3FUkV5/HKL7kA9sbvZXi7P47oLePFx8AHcwxe58lCBL0nQOj29dgkbrQ5B1v ujh9mTGOEwbUuG7yZbUa3occ3Zq/QzDWeUlYkYl909ET56ckIefxw6z0EMOzMupP4J2U 5IEs5DxkPUP3kFce+sQuf7ZYOXEMIPszNm1HS9F7Cw83kzq56KWsiDREtK1wADJR2tbr K2j4qtblCJZp0FKN2xGFTcMtqhTR0jc0oSiXOxvZ/uzGRwFHSXEryriLDDJ7leqrA97V 9JzlywZvvLquMQvBKlyI9DL2uIUiaWnYU7gyp0njLktwalUPxtHfdYyHaFiY37tOYkhz 8T4Q== X-Gm-Message-State: AOJu0Yz9P41x0fdl3cvOvRtIN0NuUt4Ykx4P30ItTg56tHZWZAGnNzlc 2JZty70CIMnSMfYETXBjlAg25WGw6GDjVBpqwcTAsUuFjWdUADHHk4tuRaAilqqfJwlEHe2YnTM jHnNnJIEsfBZYgY+MuY7uP8Ozv/Y= X-Google-Smtp-Source: AGHT+IHTwoSGHoodyeXnd5uHOmxrpMxFZjOFFwZKmmUAxwYyDeQxaiPvKuQEe3DmSRyhZt/wPZlB5WTM9w4tZCUq+qU= X-Received: by 2002:a05:6870:d8c8:b0:24f:c7cf:17fb with SMTP id 586e51a60fabf-25e2ba0c6b2mr2807206fac.22.1720142231195; Thu, 04 Jul 2024 18:17:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "David G. Johnston" Date: Thu, 4 Jul 2024 18:16:32 -0700 Message-ID: Subject: Re: psql help To: Murthy Nunna Cc: "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000a763eb061c75d25d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a763eb061c75d25d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jul 4, 2024 at 4:56=E2=80=AFPM Murthy Nunna wrote= : > > > How can I rewrite the above in psql > The only real trick is using a psql variable instead of the shell-injection of the environment variable. Use the --set CLI argument to assign the environment variable to a psql variable then refer to it in the query using :'timout_mins' Removing the limit 1 should be as simple as not typing limit 1 when you bring the query into the psql script. David J. --000000000000a763eb061c75d25d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jul 4, 2024 at 4:56=E2=80=AFPM Murthy Nunna <mnunna@fnal.gov> wrote:
<= /div>

=C2=A0

How can I rewrite the= above in psql


The only real trick is using a psql variable instead of the shell-injec= tion of the environment variable.=C2=A0 Use the --set CLI argument to assig= n the environment variable to a psql variable then refer to it in the query= using :'timout_mins'

Removing the limit 1 sho= uld be as simple as not typing limit 1 when you bring the query into the ps= ql script.

David J.

--000000000000a763eb061c75d25d--