Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZNDr-0000Yy-Jb for pgsql-general@arkaria.postgresql.org; Wed, 30 Mar 2022 01:34:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZNDq-0004wr-8o for pgsql-general@arkaria.postgresql.org; Wed, 30 Mar 2022 01:34:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZNAi-0006Xv-6s for pgsql-general@lists.postgresql.org; Wed, 30 Mar 2022 01:30:52 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nZNAf-0002iG-3l for pgsql-general@postgresql.org; Wed, 30 Mar 2022 01:30:51 +0000 Received: by mail-pj1-x1029.google.com with SMTP id v4so19174385pjh.2 for ; Tue, 29 Mar 2022 18:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to:from :subject:content-transfer-encoding; bh=RqPX72RHNm8fjeZr7XQLvxNDc519Cla4n9IAjDEPNe4=; b=vifIwp91xLzqLW2ILIgTbEPnwLUHiCS0DOywSuD8owNp/vcFokr4niMhzbpxwSEoRE osadM5L8DQee0uyrgm2N6llDncdJ13jE4QMAF4/Y9On/CYS+A3CPfBq1yD+BQ0UKPFTV B90VeKvbx+LPr2wz8vwtT1L9jLmd7jax3t3G2XcR7PwFXOtf+E07p9lvO/mxjF5RcDj4 4FbN+7Rx9YOnN0Wcf8rgxjISCGassVSZIX66wZkRd/N2x/wuuQCzwdV1p1rmZk/eX5re BBy3rcyqbC6wpCcdExg+5Y60dYwgiwIgi0ZQOfddv8N3NQvFplSG3NhIcuYdUZU9578A 6XBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject:content-transfer-encoding; bh=RqPX72RHNm8fjeZr7XQLvxNDc519Cla4n9IAjDEPNe4=; b=0QK0C/1SwXioG5QHsfmyGRNO/Hj5kZvGfG/psp2NWlcrUzERTuyCVgHitLqVtxYZVF zwiRFswPk+UFjUH78Gh5lWWD6gTK/ALN0m/kLcGZyrratNdpl+grIbtyKz9myx57BbuA BiJ4tTP6cRKTF9ZynYmC9eCMEGehQ/57EnvWaxzWkmKOllgIA/UKY3OsITKWTMF7exNU XxSZKXILAZWlW7c8ScGAA3CyqVf2vB/r1zZHiUG1i1gVNYEQZL6Zxns8857XTeH9GYHi ivR3f7QbTsV/MB0QskT5h3iiDZxjmqi9o9IOkzDjgzRQEu2XVU7mmSN+keoxPkO8v79v aUaw== X-Gm-Message-State: AOAM533JmtmLqLAeFhb9H/wSD3t2BxJCa+F+4NU1KFmoejwxJqXOVUZB NHzCvhnTLuRk7S5/bGobnW/qj2VZK4lgDA== X-Google-Smtp-Source: ABdhPJw20XzOZAGygnTYDM9ZdL1Nz8LZHxUQN904XBKM8gREyC5RU32JFFWX1lSeYUWQusFtHqMpHw== X-Received: by 2002:a17:902:e943:b0:153:f9b:99c9 with SMTP id b3-20020a170902e94300b001530f9b99c9mr32522654pll.170.1648603847634; Tue, 29 Mar 2022 18:30:47 -0700 (PDT) Received: from [192.168.2.139] ([50.53.98.191]) by smtp.googlemail.com with ESMTPSA id d21-20020a056a0010d500b004fd9ee64134sm28253pfu.74.2022.03.29.18.30.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Mar 2022 18:30:46 -0700 (PDT) Message-ID: Date: Tue, 29 Mar 2022 18:30:46 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: "pgsql-general@postgresql.org" From: Paul Jungwirth Subject: psql -f and PAGER Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, I noticed that this runs your pager: psql -f <(echo 'select * from pg_class;') but not this: echo 'select * from pg_class;' | psql A client encountered this when the psql command run from their deb's .postinst file started to hang. We can prevent it with PSQL_PAGER='', but it almost seems like a bug to me, since I expect -f to be for non-interactive use. I'd at least call it a footgun. Indeed running the pager for -f but not stdin seems opposite of the last line of these docs (https://www.postgresql.org/docs/14/app-psql.html): > Using this option is subtly different from writing psql < filename. In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand. Does it seem wrong to anyone else to run the pager from -f? Is it something the community would accept patches to change? Yours, -- Paul ~{:-) pj@illuminatedcomputing.com