public inbox for [email protected]  
help / color / mirror / Atom feed
PATH for your scripts/SQL for psql
4+ messages / 4 participants
[nested] [flat]

* PATH for your scripts/SQL for psql
@ 2025-05-19 22:49 Edwin UY <[email protected]>
  2025-05-20 01:35 ` Re: PATH for your scripts/SQL for psql David G. Johnston <[email protected]>
  2025-05-20 06:15 ` Re: PATH for your scripts/SQL for psql Laurenz Albe <[email protected]>
  2025-05-20 11:18 ` Re: PATH for your scripts/SQL for psql hubert depesz lubaczewski <[email protected]>
  0 siblings, 3 replies; 4+ messages in thread

From: Edwin UY @ 2025-05-19 22:49 UTC (permalink / raw)
  To: Pgsql-admin <[email protected]>

Hi,

Is there any settings that you can set for the PATH of your SQL/scripts so
you don't have to cd where they are or specify the full path?
Kinda like the *nix PATH settings where you can PATH to it and you just run
your command/scripts
FYI, I am NOT using psql on the database server.

Thanks.

Regards,
Ed


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PATH for your scripts/SQL for psql
  2025-05-19 22:49 PATH for your scripts/SQL for psql Edwin UY <[email protected]>
@ 2025-05-20 01:35 ` David G. Johnston <[email protected]>
  2 siblings, 0 replies; 4+ messages in thread

From: David G. Johnston @ 2025-05-20 01:35 UTC (permalink / raw)
  To: Edwin UY <[email protected]>; +Cc: Pgsql-admin <[email protected]>

On Monday, May 19, 2025, Edwin UY <[email protected]> wrote:

> Hi,
>
> Is there any settings that you can set for the PATH of your SQL/scripts so
> you don't have to cd where they are or specify the full path?
> Kinda like the *nix PATH settings where you can PATH to it and you just
> run your command/scripts
> FYI, I am NOT using psql on the database server.
>

Unable to test it right now but in Linux you should be able to add a
shebang line at the top and make the file executable.  Then make sure it is
in PATH.

David J.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PATH for your scripts/SQL for psql
  2025-05-19 22:49 PATH for your scripts/SQL for psql Edwin UY <[email protected]>
@ 2025-05-20 06:15 ` Laurenz Albe <[email protected]>
  2 siblings, 0 replies; 4+ messages in thread

From: Laurenz Albe @ 2025-05-20 06:15 UTC (permalink / raw)
  To: Edwin UY <[email protected]>; Pgsql-admin <[email protected]>

On Tue, 2025-05-20 at 10:49 +1200, Edwin UY wrote:
> Is there any settings that you can set for the PATH of your SQL/scripts so you don't have to cd where they are or specify the full path?
> Kinda like the *nix PATH settings where you can PATH to it and you just run your command/scripts
> FYI, I am NOT using psql on the database server.

No.

All you can do is use \cd:

  psql -c '\cd /some/where' -c '\i script.sql'

which is more complicated than specifying the full path, except if
you want to run several scripts with a single "psql" command.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: PATH for your scripts/SQL for psql
  2025-05-19 22:49 PATH for your scripts/SQL for psql Edwin UY <[email protected]>
@ 2025-05-20 11:18 ` hubert depesz lubaczewski <[email protected]>
  2 siblings, 0 replies; 4+ messages in thread

From: hubert depesz lubaczewski @ 2025-05-20 11:18 UTC (permalink / raw)
  To: Edwin UY <[email protected]>; +Cc: Pgsql-admin <[email protected]>

On Tue, May 20, 2025 at 10:49:33AM +1200, Edwin UY wrote:
> Hi,
> 
> Is there any settings that you can set for the PATH of your SQL/scripts so
> you don't have to cd where they are or specify the full path?
> Kinda like the *nix PATH settings where you can PATH to it and you just run
> your command/scripts
> FYI, I am NOT using psql on the database server.

No such thing exists, but please check if `\ir` isn't solving your
problem.

Best regards,

depesz







^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2025-05-20 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-05-19 22:49 PATH for your scripts/SQL for psql Edwin UY <[email protected]>
2025-05-20 01:35 ` David G. Johnston <[email protected]>
2025-05-20 06:15 ` Laurenz Albe <[email protected]>
2025-05-20 11:18 ` hubert depesz lubaczewski <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox