Bruce Momjian wrote:
> Here is a patch that handles "~" in all the file cases.
Beat me to it. :)
I do have a few issues that I was trying to sort out myself regarding this, but I guess now is as good a time as any to
askthem
here.
First off, there should be a check after the malloc to make sure NULL wasn't returned in the expand_tilde function. I
missedthat
one.
Secondly, there are a couple of SQL commands (like COPY and LOAD) and psql commands handled outside command.c (like
\copy)which
also take filenames. I'm guessing that eventually you'll want substitution in those cases as well. So does this mean
thatthe
expand_tilde function probably should not be in command.c? Placing it in common.c seems the logical place to make it at
least
available to all the psql commands (\copy included).
And finally, I was wondering if arguments with leading pipes (e.g. "|~/file") should also get substituted.
Zach Irmen