Thread: minor: ~ not resolved in psql
============================================================================ POSTGRESQL BUG REPORT TEMPLATE ============================================================================ Your name : Bas Scheffers Your email address : bas@scheffers.net System Configuration --------------------- Architecture (example: Intel Pentium) : Athlon Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.22 PostgreSQL version (example: PostgreSQL-7.3.4): PostgreSQL-7.3.4 Compiler used (example: gcc 2.95.2) : RPM (Red Hat "Severn") Please enter a FULL description of your problem: ------------------------------------------------ When opening a file in psql, ~ (the user's home dir) is resolved when using tab completion to find the file, but when you hit enter and psql actualy tries to open it, you get a file not found error. Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- N/A If you know how this problem might be fixed, list the solution below: ---------------------------------------------------------------------
> Please enter a FULL description of your problem: > ------------------------------------------------ > When opening a file in psql, ~ (the user's home dir) is resolved when > using tab completion to find the file, but when you hit enter and psql > actualy tries to open it, you get a file not found error. This is an issue in 7.4 as well.
Bas Scheffers writes: > When opening a file in psql, ~ (the user's home dir) is resolved when > using tab completion to find the file, but when you hit enter and psql > actualy tries to open it, you get a file not found error. This is not a bug. If there is not file named ~ then it can't be opened. -- Peter Eisentraut peter_e@gmx.net
Peter Eisentraut wrote: > Bas Scheffers writes: > > > When opening a file in psql, ~ (the user's home dir) is resolved when > > using tab completion to find the file, but when you hit enter and psql > > actualy tries to open it, you get a file not found error. > > This is not a bug. If there is not file named ~ then it can't be opened. If I am in psql and do: \i ~/<tab> I see all the files in home directory. If I then type in a file name: test=> \i ~/server.log ~/server.log: No such file or directory I get file not found. Sure looks like a bug to me. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
On Thu, 2003-10-30 at 13:13, Peter Eisentraut wrote: > Bas Scheffers writes: >=20 > > When opening a file in psql, ~ (the user's home dir) is resolved when > > using tab completion to find the file, but when you hit enter and psql > > actualy tries to open it, you get a file not found error. >=20 > This is not a bug. If there is not file named ~ then it can't be opened. If the file doesn't exist, then surely tab completion shouldn't pick it up either. \i ~/.b<tab><tab> <- picks up files After finishing a name, hit enter -- the file could not be found.
Peter Eisentraut said: > This is not a bug. If there is not file named ~ then it can't be > opened. I am not trying to open a file named ~, I am using it as part of a file name, ie: ~/ewap/sql/ewap.sql. (where ~=/home/bas) This is perfectly valid on any unix system and especialy since tab completion of \i supports it, so should the function that does the actual opening of the file, I would think... Bas.
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Peter Eisentraut wrote: >> Bas Scheffers writes: >>> When opening a file in psql, ~ (the user's home dir) is resolved when >>> using tab completion to find the file, but when you hit enter and psql >>> actualy tries to open it, you get a file not found error. >> >> This is not a bug. If there is not file named ~ then it can't be opened. > Sure looks like a bug to me. I think so too. If tab completion can find the file then we ought to be willing to open it. Changing tab completion to not find the file would be okay too, or at least consistent. It's the inconsistency that leads me to call it a bug. regards, tom lane
On Thursday 30 October 2003 19:18, Bas Scheffers wrote: > > This is not a bug. If there is not file named ~ then it can't be > > opened. > I am not trying to open a file named ~, I am using it as part of a file > name, ie: ~/ewap/sql/ewap.sql. (where ~=/home/bas) This is perfectly valid > on any unix system and especialy since tab completion of \i supports it, > so should the function that does the actual opening of the file, I would > think... It's not valid in a unix system. It's an expansion performed by most shells. In my system (Linux, bash2): [patxifijo:~] ls ~/2do.txt /home/folarte/2do.txt [patxifijo:~] ls '~/2do.txt' ls: ~/2do.txt: No such file or directory In fact it works with all programs: [patxifijo:~] echo ~/2do.txt /home/folarte/2do.txt [patxifijo:~] echo '~/2do.txt' ~/2do.txt F.O.S.
Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > Peter Eisentraut wrote: > >> Bas Scheffers writes: > >>> When opening a file in psql, ~ (the user's home dir) is resolved when > >>> using tab completion to find the file, but when you hit enter and psql > >>> actualy tries to open it, you get a file not found error. > >> > >> This is not a bug. If there is not file named ~ then it can't be opened. > > > Sure looks like a bug to me. > > I think so too. If tab completion can find the file then we ought to be > willing to open it. Changing tab completion to not find the file would > be okay too, or at least consistent. It's the inconsistency that leads > me to call it a bug. Added to TODO: * Have psql '\i ~/<tab><tab>' actually load files it displays from home dir -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073