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 1qF4dK-0001RG-8M for pgsql-general@arkaria.postgresql.org; Fri, 30 Jun 2023 03:17:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qF4dH-0005Zz-Dl for pgsql-general@arkaria.postgresql.org; Fri, 30 Jun 2023 03:17:15 +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 1qF4dH-0005Zq-17 for pgsql-general@lists.postgresql.org; Fri, 30 Jun 2023 03:17:15 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qF4dE-001CqC-Pj for pgsql-general@lists.postgresql.org; Fri, 30 Jun 2023 03:17:13 +0000 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-553a998bca3so976333a12.2 for ; Thu, 29 Jun 2023 20:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688095031; x=1690687031; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=B+fJRnj/UXI824MnUsl4i8vAVRIfRzehOi3pjg1clP8=; b=NeS+cywZtWvzoo8NY9EE81EZEd05OE/8n4hVIuWAPqYYL9XpDlSBGLpGLDn2BY/gYC JYzzm7piADIPmlG7kYG7Dbq5fjZvT9ID/hFw2yUJC4nQXv3uEb+OC3pPLjxy0Y0tlai7 miYqCWKh2Ci7sb/aTGQTCBLL02V6Y4+yYKf0T5JoxfhqnLMAOehK82Dcj/YbdWDuxRwT F/zz69r9SePU267zXaQDB2CvE2XYRyYyauLGBG9GYl1Xl5E2DsfisBL1BAxJfyq8d/kk dt/CXlTTZvHh1JG1h7KZmBHAmAfWWSI5iz3GNpyjCu0Zk0TYMpy4NwZY3LhaBiM3A+PY UZdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688095031; x=1690687031; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=B+fJRnj/UXI824MnUsl4i8vAVRIfRzehOi3pjg1clP8=; b=Z1tsuBvCDoNFlDH/ViyDGJ+IHujg1a7LeQmXZ5Hf/GI6SNlWmdiRj4sxFnL72sL6c5 weOCuczaPc/3ct6+XQyXy7k2xY3i1YjIB12UOspWj2KNEnJREbqDKRDaq3YsrY4ab3Ji XoUiJFU6o42sCsSXE4wBKiWSwZlxYMGsyPqZaAMAJ4Ot+Xej48KvuyhUKpfdPYcs1lMs D7x2k43KS6s4Ezg9gGTPffLnUv4a5Xxa8fqQTb773C/vzlotJgfFr9Mf5f0+iFdPrbM0 /pw1QKXAufEZP0ZhG8Xg0PUI9bFjdgzzwFvdsVqhxXSeLk6Ncr9bM5a7qorRl2Gd8pWq Volw== X-Gm-Message-State: ABy/qLb0pwK5gCXrN4QYkz3Q4ZWdw1vFCl/LDqLl6V0AxUhHrgZKX9Db hNCvjguaGTFlgllMvxDuZdQ= X-Google-Smtp-Source: APBJJlGPgCE9OltsyozJJl+FqWnZCCV0I7fa7iA/ZroVQL5D/lanYoljrriGdIBopoMQtWeOlNONQw== X-Received: by 2002:a05:6a20:4406:b0:12d:675a:21ce with SMTP id ce6-20020a056a20440600b0012d675a21cemr754917pzb.42.1688095031356; Thu, 29 Jun 2023 20:17:11 -0700 (PDT) Received: from jrouhaud (36-231-71-143.dynamic-ip.hinet.net. [36.231.71.143]) by smtp.gmail.com with ESMTPSA id r14-20020a170902be0e00b001b243a20f26sm9645437pls.273.2023.06.29.20.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 20:17:10 -0700 (PDT) Date: Fri, 30 Jun 2023 11:16:36 +0800 From: Julien Rouhaud To: pf@pfortin.com Cc: pgsql-general@lists.postgresql.org Subject: Re: psql and pgpass.conf on Windows Message-ID: <20230630031636.jot6q5v77dlinlro@jrouhaud> References: <20230629224200.080cc1a4.pfortin@pfortin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230629224200.080cc1a4.pfortin@pfortin.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Jun 29, 2023 at 10:42:00PM -0400, pf@pfortin.com wrote: > > Windows: %APPDATA%\postgresql\pgpass.conf > > On Linux, this works. However, on Windows, psql will not read > pgpass.conf (tried in just about every location I could think of) > > Even: "set PGPASSFILE=" does not work. > > Finally, out of frustration, tried: > set PGPASSWORD= > and that got me past the password issue, only to now get: > 'more' is not recognized as an internal or external command, > operable program or batch file. > > Given the number of queries about pgpass.conf and finding no answer that > works, is there no bug report on this? > > Thinking that psql was not adjusted for Windows, tried naming the file: > .pgpass > .pgpass.conf > also in various locations to no avail... > What am I (and all the others found in searches) missing? Or are there > unresolved bugs in psql? > - pgpass.conf > - expecting external executable: 'more' The file should indeed be by default %APPDATA%/postgresql/pgpass.conf, and it's known to be functional on Windows. The fact that you hit some error with a "more" program makes me think that your script setup some environment variables (like PAGER=more, which would explain why you hit that error) that maybe interfere with file location and/or name. Now, since setting PGPASSFILE also doesn't work I start to wonder if there's another problem. Does the password (or any other field) contain some non-ASCII characters? There could be an encoding issue in the file, or maybe the problem is with the presence or absence of a BOM in the file. Another thing you should try just in case is to replace backwards slashes with forward slashes. If none of that work, you could also check what file psql is trying to open using the equivalent of "strace" for Windows, if such a thing exists.