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 1tBzCY-0085oc-6I for pgsql-general@arkaria.postgresql.org; Fri, 15 Nov 2024 16:29:41 +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 1tBzCU-00AmtT-8b for pgsql-general@arkaria.postgresql.org; Fri, 15 Nov 2024 16:29:38 +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 1tBzCT-00AmsW-R9 for pgsql-general@lists.postgresql.org; Fri, 15 Nov 2024 16:29:38 +0000 Received: from smtp-26.smtpout.orange.fr ([80.12.242.26] helo=smtp.smtpout.orange.fr) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tBzCQ-00236V-Hs for pgsql-general@lists.postgresql.org; Fri, 15 Nov 2024 16:29:37 +0000 Received: from X250.home ([90.52.110.125]) by smtp.orange.fr with ESMTPA id BzCMtLxhddt0FBzCMtxGmV; Fri, 15 Nov 2024 17:29:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1731688171; bh=GP0soVLtluppMUxvLKR5MSvz3W+4WRXosyVK2Rl4cEM=; h=Date:From:To:Subject:Message-Id:Mime-Version; b=otY6Du/wczg8E5QXmSD9K6wnixrWA8QmwjLkiQjU2tYykEaM9EDazL+uPn7+81ErR t56r2yYhn9NsDD7MWziDRXX/cxInFqFJbWMDapetWRzCDzcAX2Hm/2Sc8YrcagbR3q 0Mf2YoTOjmg6W4JJBRZFUyoGtA4rhmzQekWyWGZX1+QQ0LjDgOEdfVPHj2pJpZ8Bit rvAZ/quVUUi/TsUZ8e5od20CQtMSBQAwySkgVhCXoTbgDqWJnjejtwAuOQIF4wO2s4 sB2/rAgjRu+SCmF0AJuDFFc/zQa7HdECL39x1QMFRpp9InXD+IqzVTjWqCL76zqTiL NSVEeCOZECoug== X-ME-Helo: X250.home X-ME-Auth: dnYubGlzdHNAd2FuYWRvby5mcg== X-ME-Date: Fri, 15 Nov 2024 17:29:31 +0100 X-ME-IP: 90.52.110.125 Date: Fri, 15 Nov 2024 17:29:30 +0100 From: Vincent Veyron To: Patrick FICHE Cc: "pgsql-general@lists.postgresql.org" Subject: Re: Retrieve filename within a script Message-Id: <20241115172930.c11b7546b49af380f2d8840f@wanadoo.fr> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 14 Nov 2024 08:42:36 +0000 Patrick FICHE wrote: > I was wondering if it was possible to get the filename provided as an arg= ument to psql. > psql -f /tmp/test.sql >=20 Since you know it already, you could pass it as a variable : psql -f /tmp/test.sql -v my_path=3D'/tmp/test.sql' and retrieve it with SELECT :'my_path'; --=20 Bien =E0 vous, Vincent Veyron https://marica.fr Logiciel de gestion des contentieux juridiques, des contrats et des sinistr= es d'assurance