In psql, \i
can be used to read and execute a sql script.
But I have to specify a pathname to the script file to \i
, which is very inconvenient, when pathname is long and differs from script to script.
Is there something similar to $PATH
in bash
for psql
's \i
to search for a script based only on the filename of a sql script?
Or do I really have to specify a pathname to \i
every time I run a sql script file?
Thanks.
I am trying to place https://stackoverflow.com/a/771880/156458 into a sql script, so that I can reuse it.