Re: psql \i handling ~ in specified file name

From: Zach Irmen <zirmen(at)shaw(dot)ca>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: psql \i handling ~ in specified file name
Date: 2004-01-08 06:26:47
Message-ID: 003301c3d5b0$64cb20a0$0b01010a@ed.shawcable.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 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.

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).

And finally, I was wondering if arguments with leading pipes (e.g. "|~/file") should also get substituted.

Zach Irmen

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Claudio Natoli 2004-01-08 07:33:10 fork/exec patch: CreateProcess calls for Win32
Previous Message Korea PostgreSQL Users' Group 2004-01-08 06:25:53 Patch of intarray module in v7.4.1