Re: psql \i handling ~ in specified file name - Mailing list pgsql-patches

From Zach Irmen
Subject Re: psql \i handling ~ in specified file name
Date
Msg-id 003301c3d5b0$64cb20a0$0b01010a@ed.shawcable.net
Whole thread Raw
In response to Re: psql \i handling ~ in specified file name  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: psql \i handling ~ in specified file name
List pgsql-patches
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


pgsql-patches by date:

Previous
From: "Korea PostgreSQL Users' Group"
Date:
Subject: Patch of intarray module in v7.4.1
Next
From: Claudio Natoli
Date:
Subject: fork/exec patch: CreateProcess calls for Win32