On Tuesday 14 October 2003 23:38, Tom Lane wrote:
> Ian Barwick <barwick@gmx.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@gmx.net