Re: Retrieve filename within a script - Mailing list pgsql-general

From Vincent Veyron
Subject Re: Retrieve filename within a script
Date
Msg-id 20241115172930.c11b7546b49af380f2d8840f@wanadoo.fr
Whole thread Raw
In response to Retrieve filename within a script  (Patrick FICHE <Patrick.Fiche@aqsacom.com>)
List pgsql-general
On Thu, 14 Nov 2024 08:42:36 +0000
Patrick FICHE <Patrick.Fiche@aqsacom.com> wrote:

> I was wondering if it was possible to get the filename provided as an argument to psql.
> psql -f /tmp/test.sql
>

Since you know it already, you could pass it as a variable :

psql -f /tmp/test.sql -v my_path='/tmp/test.sql'

and retrieve it with SELECT :'my_path';

--
                    Bien à vous, Vincent Veyron

https://marica.fr
Logiciel de gestion des contentieux juridiques, des contrats et des sinistres d'assurance



pgsql-general by date:

Previous
From: Andy Hartman
Date:
Subject: Re: DB Files
Next
From: Bharani SV-forum
Date:
Subject: Need exact SQL query to find List of Detach Partitioned Tables (Yet to be Dropped)