From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Zach Irmen <zirmen(at)shaw(dot)ca> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql \i handling ~ in specified file name |
Date: | 2004-01-08 18:04:12 |
Message-ID: | 200401081804.i08I4Ce11805@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Zach Irmen wrote:
> 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 ask
> them here.
>
> First off, there should be a check after the malloc to make sure
> NULL wasn't returned in the expand_tilde function. I missed that
> one.
OK, test added. I see no way to recover from a malloc failure in this
case because we can't honor their specification of file name, so we have
to exit.
> 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 that
> the 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).
Yes, seems like that will be required. Please use my attached version
to make the adjustments.
> And finally, I was wondering if arguments with leading pipes
> (e.g. "|~/file") should also get substituted.
Yep, that too.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 2.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2004-01-08 18:18:41 | Re: psql \i handling ~ in specified file name |
Previous Message | Bruce Momjian | 2004-01-08 18:02:33 | Re: psql \i handling ~ in specified file name |