Re: psql tab completion bug and possible fix

From: Ian Barwick <barwick(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: psql tab completion bug and possible fix
Date: 2003-10-15 20:26:38
Message-ID: 200310152226.38481.barwick@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Tuesday 14 October 2003 23:38, Tom Lane wrote:
> Ian Barwick <barwick(at)gmx(dot)net> writes:
> > A patch for this using PQescapeString (is there another preferred
> > method?) is attached as a possible solution.
>
> Surely all those replacements of \\ with \\\\ are wrong.

The slash in the slash command gets escaped too...:

#include <stdio.h>
#include "libpq-fe.h"

main() {
char *s, *r;

s = "\\d";

printf("%s\n", s);

r = (char *) malloc(strlen(s) * 2);
PQescapeString(r, s, strlen(s));

printf("%s\n", r);

if(strcmp(r, "\\\\d") == 0) {
printf("match\n");
}

free(s);
free(r);
}

Without \\\\ tab expansion for slash commands doesn't work.

There may of course be better ways of solving this problem.

Ian Barwick
barwick(at)gmx(dot)net

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-10-15 20:45:19 Re: psql tab completion bug and possible fix
Previous Message Fabrizio Mazzoni 2003-10-15 18:02:50 psql-it corrected